Showing posts with label Ubuntu. Show all posts
Showing posts with label Ubuntu. Show all posts

Thursday, December 11, 2014

SSH

$ ssh-keygen -t rsa -C "your_email@example.com"
# Creates a new ssh key, using the provided email as a label
# Generating public/private rsa key pair.
Enter file in which to save the key (/home/you/.ssh/id_rsa):
Enter passphrase (empty for no passphrase): [Type a passphrase]
Enter same passphrase again: [Type passphrase again]

Embedding password into key file
$ openssl rsa < id_rsa > id_rsa_withpass
Enter pass phrase:************
writing RSA key

useradd tai
passwd -u -f tai
usermod -g wheel tai
mkdir /home/tai/.ssh
mv authorized_keys /home/tai/.ssh/
chown tai:tai /home/tai/.ssh
chown tai:tai /home/tai/.ssh/authorized_keys
chmod 700 /home/tai/.ssh
chmod 600 /home/tai/.ssh/authorized_keys
sudo visudo

Tuesday, September 30, 2014

Virtualhost for Apache 2.4

VirtualHost *:80>
        DocumentRoot /your_path
        ServerName domain.local.com
        # ErrorLog /var/log/apache2/error.log
        <Directory /your_path>
                Options All +Indexes +FollowSymLinks
                 AllowOverride All
                 Order allow,deny
                 Allow from all
                 Require local
        </Directory>
</VirtualHost>

Sunday, November 3, 2013

How To Create a SSL Certificate on nginx for Ubuntu 12.04

Step One—Create a Directory for the Certificate
The SSL certificate has 2 parts main parts: the certificate itself and the public key. To make all of the relevant files easy to access, we should create a directory to store them in:
sudo mkdir /etc/nginx/ssl

We will perform the next few steps within the directory:
cd /etc/nginx/ssl


Step Two—Create the Server Key and Certificate Signing Request
Start by creating the private server key. During this process, you will be asked to enter a specific passphrase. Be sure to note this phrase carefully, if you forget it or lose it, you will not be able to access the certificate.
sudo openssl genrsa -des3 -out server.key 1024

Follow up by creating a certificate signing request:
sudo openssl req -new -key server.key -out server.csr

This command will prompt terminal to display a lists of fields that need to be filled in.

The most important line is "Common Name". Enter your official domain name here or, if you don't have one yet, your site's IP address. Leave the challenge password and optional company name blank.

You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [AU]:US
State or Province Name (full name) [Some-State]:New York
Locality Name (eg, city) []:NYC
Organization Name (eg, company) [Internet Widgits Pty Ltd]:Awesome Inc
Organizational Unit Name (eg, section) []:Dept of Merriment
Common Name (e.g. server FQDN or YOUR name) []:example.com                 
Email Address []:webmaster@awesomeinc.com


Step Three—Remove the Passphrase
We are almost finished creating the certificate. However, it would serve us to remove the passphrase. Although having the passphrase in place does provide heightened security, the issue starts when one tries to reload nginx. In the event that nginx crashes or needs to reboot, you will always have to re-enter your passphrase to get your entire web server back online.


Use this command to remove the password:
sudo cp server.key server.key.org

sudo openssl rsa -in server.key.org -out server.key


Step Four— Sign your SSL Certificate
Your certificate is all but done, and you just have to sign it.


Keep in mind that you can specify how long the certificate should remain valid by changing the 365 to the number of days you prefer. As it stands this certificate will expire after one year.
sudo openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt

You are now done making your certificate.

Step Five—Set Up the Certificate

Now we have all of the required components of the finished certificate.The next thing to do is to set up the virtual hosts to display the new certificate.
Let's create new file with the same default text and layout as the standard virtual host file. You can replace "example" in the command with whatever name you prefer:
sudo nano /etc/nginx/sites-available/example

Scroll down to the bottom of the file and find the section that begins with this:
# HTTPS server
server {
  listen 443;
  server_name example.com;

  root /usr/share/nginx/www;
  index index.html index.htm;
  
  ssl on;
  ssl_certificate /etc/nginx/ssl/server.crt;
  ssl_certificate_key /etc/nginx/ssl/server.key;
}
sudo service nginx restart

Refs https://www.digitalocean.com/community/articles/how-to-create-a-ssl-certificate-on-nginx-for-ubuntu-12-04

Monday, October 7, 2013

Install RabbitVCS on Ubuntu 12.10

First install some prerequisites.

$ sudo apt-get update

$ sudo apt-get install python-nautilus python-configobj python-gtk2 python-glade2 python-svn python-dbus python-dulwich subversion meld gconf-editor


Download the tarball, untar it and run the setup script

$ wget http://rabbitvcs.googlecode.com/files/rabbitvcs-0.15.2.tar.bz2

$ tar jxvf rabbitvcs-0.15.2.tar.bz2

$ cd rabbitvcs-0.15.2/

$ sudo python setup.py install --install-layout=deb


Still inside the rabbitvcs-0.15.2 directory, cd to the nautilus-3.0 under the clients directory and copy the RabbitVCS.py to the extensions dir

$ cd clients/nautilus-3.0

$ sudo cp RabbitVCS.py /usr/share/nautilus-python/extensions/


Logout and log back in. Now create a folder and right click on it to see the RabbitVCS menu, perform a checkout.

Refs: http://linuxdrops.com/install-rabbitvcs-svn-git-client-on-ubuntu-12-1012-0411-1011-04/

Monday, September 23, 2013

Install RabbitVCS Svn, Git Client On Ubuntu 12.10/12.04/11.10/11.04

Overview

There are some cool interfaces for subversion control for windows however when it comes to desktop linux distros, you find very few that can match their windows counterpart like TortoiseSVN. RabbitVCS is one such client that comes with all the bells and whistles. Here is a post about installing it.

First install some prerequisites.
$ sudo apt-get update

$ sudo apt-get install python-nautilus python-configobj python-gtk2 python-glade2 python-svn python-dbus python-dulwich subversion meld gconf-editor


Download the tarball, untar it and run the setup script
$ wget http://rabbitvcs.googlecode.com/files/rabbitvcs-0.15.2.tar.bz2

$ tar jxvf rabbitvcs-0.15.2.tar.bz2

$ cd rabbitvcs-0.15.2/

$ sudo python setup.py install --install-layout=deb


Still inside the rabbitvcs-0.15.2 directory, cd to the nautilus-3.0 under the clients directory and copy the RabbitVCS.py to the extensions dir

$ cd clients/nautilus-3.0
$ sudo cp RabbitVCS.py /usr/share/nautilus-python/extensions/


Logout and log back in. Now create a folder and right click on it to see the RabbitVCS menu, perform a checkout.

Refs: http://linuxdrops.com/install-rabbitvcs-svn-git-client-on-ubuntu-12-1012-0411-1011-04/

Fix Error: Bomb icon
The bomb emblem means that there is some sort of error in the status checker.  It is possible that error messages will show up in ~/.config/rabbitvcs/RabbitVCS.log but I'm not sure it will for your problem.  I'm not sure what would cause your status checker to be getting errors but it could be that your svn or git dependencies are not correctly installed, or installed in a way that doesn't work with RabbitVCS.  Are the bomb emblems showing up in git repositories or svn repositories or both?

One thing that might help is restarting the status checker.  You can do this by killing the checkerservice.py process.  Run "ps aux | grep rabbitvcs" and kill the process that says checkerservice.py.  Once you do that, restart nautilus and see what happens.

Thursday, September 19, 2013

How to install Sublime Text 2 on Ubuntu 12.04 (Unity)

Step 1

Download the tarfile that suits you best and extract it. Here’s the command to extract tar.bz2 files:
1.tar xf Sublime\ Text\ 2.0.1\ x64.tar.bz2
You’ll notice that I got the 64-bit version. The reason is that it’s lightning fast. So, go for that if you can!

Step 2

You’ll get a “Sublime Text 2″ folder after extraction. This folder contains all the files that Sublime Text will need. So we have to move that folder somewhere more appropriate. Like the “/opt/” folder :
1.sudo mv Sublime\ Text\ 2 /opt/

Step 3

At some point you’d want to be able to call Sublime Text from the Terminal by just typing “sublime”. To do that, we’ll just create a symbolic link in “/usr/bin” like thus:
1.sudo ln -s /opt/Sublime\ Text\ 2/sublime_text /usr/bin/sublime

Step 4

Now that our files are at the right place, we need to create a launcher in Unity. To do this, we’re going to create a .desktop file in “/usr/share/applications”:
1.sudo sublime /usr/share/applications/sublime.desktop
And paste the following content:
[Desktop Entry]
Version=1.0
Name=Sublime Text 2
# Only KDE 4 seems to use GenericName, so we reuse the KDE strings.
# From Ubuntu's language-pack-kde-XX-base packages, version 9.04-20090413.
GenericName=Text Editor
Exec=sublime
Terminal=false
Icon=/opt/Sublime Text 2/Icon/48x48/sublime_text.png
Type=Application
Categories=TextEditor;IDE;Development
X-Ayatana-Desktop-Shortcuts=NewWindow
[NewWindow Shortcut Group]
Name=New Window
Exec=sublime -n
TargetEnvironment=Unity
As you can see, these lines are quite straightforward. Go ahead and experiment a bit with them.

Step 5

Now you would probably want to open all text files with Sublime Text 2. The easiest way to do that is to open up the file associations list:
1.sudo sublime /usr/share/applications/defaults.list
And replace all occurrences of gedit.desktop with sublime.desktop.
Tada ! There you go. You now have Sublime Text 2 installed on Unity on Ubuntu 12.04, like a pro.