Total Pageviews

Thursday, July 14, 2011

How to attach and mount EBS volume into EC2 Instance Ubuntu 10.10

 

http://yoodey.com/how-attach-and-mount-ebs-volume-ec2-instance-ubuntu-1010

Updated!
Before you do this, backup all /var into /var-backup by sudo rsync -avr /var/* /var-backup/
After mounting EBS, you can rsync restore /var by sudo rsync -avr /var-backup/* /var/
Using EBS volume can decrease risk of server crash suddenly or "permission denied" problem in EC2 server. The logic, after we create instance store, we create new EBS volume which we can set the capacity as we need. In this cases, i create 60GB EBS and will using it as /var in instance store. Now, let configure our EC2 and using EBS as indepent storage.
1. Create EBS Volume and attach it into instance store in EC2 panel management. Use same region, ex : east-1b
2. Login into instance store SSH.
3. In my configuration, EBS Volume located in /dev/sdg. So remember what yours.
4. Use sudo fdisk -l to see if your EBS already attached
Disk /dev/sdg: 64.4 GB, 64424509440 bytes
255 heads, 63 sectors/track, 7832 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
5. Formating EBS Volume so we can use it by sudo mkfs -t ext4 /dev/sdg and you will get result :
mke2fs 1.41.12 (17-May-2010)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
3932160 inodes, 15728640 blocks
786432 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
480 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424
This will takes a long time, like 10-30 minutes.
6. Edit /etc/fstab and add this :
/dev/sdg        /var    auto    defaults,nobootwait,noatime     0       0
and reboot from EC2 panel management. Now, you use EBS for all installed program and www.

Wednesday, July 13, 2011

7ZIP on Ubuntu server

Install p7zip (7zip)
sudo apt-get install p7zip

To Compress:
p7zip mystuff

To decompress:
p7zip -d mystuff.7z 

Reference URL: http://tombuntu.com/index.php/2008/07/21/add-7z-7-zip-file-archive-support-to-ubuntu/ 

Friday, July 8, 2011

Setting up SVN server on Ubuntu

Instructions to setup SVN server on ubuntu:

http://www.howtogeek.com/howto/ubuntu/install-subversion-with-web-access-on-ubuntu/

In case URL link doesnt work, content below.

Install Subversion with Web Access on Ubuntu

This article covers installing subversion with the apache module so that it can be easily accessed from other systems on a public network. If you want a more secure svn server, you could use svnserve+ssh, which isn’t covered in this article.
To install subversion, open a terminal and run the following command:
sudo apt-get install subversion libapache2-svn
We’re going to create the subversion repository in /svn, although you should choose a location that has a good amount of space.
sudo svnadmin create /svn
Next we’ll need to edit the configuration file for the subversion webdav module. You can use a different editor if you’d like.
sudo gedit /etc/apache2/mods-enabled/dav_svn.conf
The Location element in the configuration file dictates the root directory where subversion will be acessible from, for instance: http://www.server.com/svn
<Location /svn>
The DAV line needs to be uncommented to enable the dav module
# Uncomment this to enable the repository,
DAV svn
The SVNPath line should be set to the same place your created the repository with the svnadmin command.
# Set this to the path to your repository
SVNPath /svn
The next section will let you turn on authentication. This is just basic authentication, so don’t consider it extremely secure. The password file will be located where the AuthUserFile setting sets it to…  probably best to leave it at the default.

# Uncomment the following 3 lines to enable Basic Authentication
AuthType Basic
AuthName “Subversion Repository”
AuthUserFile /etc/apache2/dav_svn.passwd
To create a user on the repository use, the following command:

sudo htpasswd2 -cm /etc/apache2/dav_svn.passwd <username>
Note that you should only use the -c option the FIRST time that you create a user. After that you will only want to use the -m option, which specifies MD5 encryption of the password, but doesn’t recreate the file.
Example:
sudo htpasswd2 -cm /etc/apache2/dav_svn.passwd geek
New password:
Re-type new password:
Adding password for user geek
Restart apache by running the following command:

sudo /etc/init.d/apache2 restart
Now if you go in your browser to http://www.server.com/svn, you should see that the repository is enabled for anonymous read access, but commit access will require a username.

If you want to force all users to authenticate even for read access, add the following line right below the AuthUserFile line from above. Restart apache after changing this line.

Require valid-user
Now if you refresh your browser, you’ll be prompted for your credentials: