No-IP for those with no static IP…

So people do not have a permanent ip and it makes supporting those users/clients. As you need to keep track of there ip when you need to log into there system/server. A handy way to do this is to use a third party service that tracks your clients non static ip to a dynamic name service. On of these services is no-ip.org This service requires you to install software upon your clients server/machine. Every 30 minutes the software talks to the no-ip.org domain name service and inserts the ip of the clients wan into the no-ip.org name server. So instead of remembering the clients ip address you can remember there name and attach the no-ip.org address. There are many other domains no-ip.org allows you to choose from but this is the domain I have choosen. e.g. client.no-ip.org. better than remembering a ip address. To install no-ip, there following steps are required on you clients server/machine.

Generic:

You must create a on no-ip.org for you to be able to add hostnames. Once this is done you will need to log into your account and be able to add hosts which are the machines that have the dynamic ip. Note, do not create the hosts into groups or one machine will change all the machines ip to the same ip as the machine that does the update. Leave them ungrouped. Below is a image of the buttons that need to be ticked.

CentOS:

Download the no-ip.org unix client.

# wget https://www.no-ip.com/client/linux/noip-duc-linux.tar.gz

# tar xvfz www.no-ip.com/client/linux/noip-duc-linux.tar.gz

You can compile the source code yourself, but for the purposes of the excercise

# cd noip-2.1.9-1/binaries

# noip2.i686 /usr/local/bin/noip2

# chown root:root /usr/local/bin/noip2

# chmod 755 /usr/local/bin/noip2

Now we run noip for the first time to configure for connection to the no-ip service.

# /usr/local/bin/noip2 -C

# cd ..

We now create the startup script so no-ip starts up when the machine starts up.

# cp redhat.noip.sh /etc/rc.d/init.d/noip2

# chmod 755 /etc/rc.d/init.d/noip2

# cd /etc/rc.d/rc5.d

# ln -s /etc/rc.d/init.d/noip2 S99noip2

# cd ../rc6.d

# ln -s /etc/rc.d/init.d/noip2 K99noip2

We can now start the no-ip service

# /etc/rc.d/init.d/noip2 stop

# /etc/rc.d/init.d/noip2 start

Install Virtualbox Headless Server for Guests Operating Systems.

To install Virtualbox which is a free virtual machine software, that allows you to run machines/containers upon a physical server. Virtualbox is free open source technology. It is available for all platforms e.g. Mac OSX, Centos, Windows etc. Virtualbox is very easy to setup upon linux variants as there is software packages already available that you can install in one easy command. Below I will show you howto install Virtualbox and create a container. Virtualbox has a very active community, where help can be found very easily.

This installation will show you how to install via headless solution where no gui isused.

CENTOS:

To install Virtualbox upon Centos is a very easy procedure. The following steps will tell how to install Virtualbox upon centos.

# cd /etc/yum.repos.d

# wget http://download.virtualbox.org/virtualbox/rpm/rhel/virtualbox.repo

# yum –enablerepo rpmforge install dkms

Below we will now install the kernel drivers for Virtualbox.

# yum groupinstall “Development Tools”

# yum install kernel-devel

Now we will install the Virtualbox package itself.

# yum install VirtualBox-4.1

The last item we need to do is add the user who will run the Virtualbox application to the Virtualbox group.

# usermod -G vboxusers username

Ubuntu:

To install Virtualbox upon Ubuntu is a very easy procedure. The following steps will tell how to install Virtualbox upon centos.

# cd /etc/apt

# vi sources.list

Add the following line below to the sources.list file so we can talk to the Virtualbox repository.

deb http://download.virtualbox.org/virtualbox/debian lucid contrib non-free

Now we will install the Virtualbox package itself.

# wget -q http://download.virtualbox.org/virtualbox/debian/oracle_vbox.asc -O- | sudo apt-key add -

The last item we need to do is add the user who will run the Virtualbox application to the Virtualbox group.

# sudo apt-get update

# sudo apt-get install virtualbox-4.1

Below I use the root user, you can use any user you believe you want to run

# usermod -a vboxusers

Next we will now post howto setup/create a virtual machine in our next post.

Gigabyte G41MT-S2P Motherboard:

g41mt-s2p

g41mt-s2p

Again back on my quest to build new nas unit. I popped throu my regular computer store. After choosing the cheapest bang for buck motherboard, that could take my dual core cpu. I upgraded to 16gb of DDR 1333 ram, for this reason to run many virtual machines on virtualbox. To get over the four usb disk limit, I am looking for pci express four port sata cards. I expect to shop them off ebay due to the cost. Onboard video, no pci express video card needed for the server. I think this is a good choice till I upgrade to a i based cpu, and motherboard comes along.

 

Disable SELinux:

CentOS:

To disable SElinux, the security system within centos, you need to modify the SElinux file. Reasons for wanting to disable SElinux, would be that your server is internal, and to configure each service is a waste of time. SELinux is good for machines that are facing the internet, within a De-militarized Zone.

The SELinux configuration file is located at

/etc/selinux/config

To disable SELinux go to the configuration file look for the following line

SELINUX

then change the line to

SELINUX=disabled

# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing – SELinux security policy is enforced.
# permissive – SELinux prints warnings instead of enforcing.
# disabled – SELinux is fully disabled.
SELINUX=disabled
# SELINUXTYPE= type of policy in use. Possible values are:
# targeted – Only targeted network daemons are protected.
# strict – Full SELinux protection. SELINUXTYPE=targeted
# SETLOCALDEFS= Check local definitition file.
SETLOCALDEFS=0

The above with take effect during the next reboot, but if you need the effect to be immediate you can disable SELinux immediately at the command line with the following command

# setenforce 0

Network Time Protocol:

Keeping track of time on your server can become a bit daunting, when you start having multiple number of servers. A solution is called ntp (network time protocol). The machine ever so often, loses time, by going out up to a few hours. Defined period checks with a main time server, and adjusts your machines time if it is out from the main timeserver.

CentOS:

The following commands below will install and configure ntp under CentOS.

# yum install ntp
# chkconfig ntpd on
# ntpdate pool.ntp.org
# /etc/rc.d/init.d/ntpd restart

The results will be shown as below.

Shutting down ntpd:    [ OK ]
Starting ntpd:              [ OK ]

Ubuntu:

The following commands below will install and configure ntp under Ubuntu.

# apt-get install ntp

# /etc/init.d/ntp restart

Configuring the ntp.conf files will not be needed as they are automatically configured during installation.

Generic

Another way around this issue is to manually have the ntpdate application run directly via the cron to update the time. This issue is caused on virtual machines where the virtual software forces the virtual machine to sync with the host machine. Below is a work around. Just enter this into cron. The ip of the time server is au.pool.ntp.org

# crontab -e

*/5 * * * * /sbin/ntpdate -u 149.20.68.17

Thermaltake v6 BackX Edition Case:

thermaltake v6 blacx edition

thermaltake v6 blacx edition

Its time again to upgrade my home made nas running ubuntu server. Current machine is a core duo running five 500gb seagate hard disks. One of my pet peeves of the current nas server is when I disk dies I need to shutdown the disk, pull the case apart, take out the disk then assemble the unit back to operating normality. I have decided with the new server that the disks shall be hot swappable. In order for this to be achieved in need to have a computer case where all the disks can be accessed from the front of the computer. Hence where the thermaltake v6 comes into play. I have been shopping around for some cases and found the prices too rediculous to do anything about this. It was not today when I turned up to my regular computer store that the sales person told me they had the thermaltake cases without power supplies for $79. I thought this was a bargain, due to most cases come with a 420 watt power supply that you automatically replace anyway. With the main piece of gear found, to make the new nas a reality, I now seek a new motherboard, with as many onboard sata ports, and hot swappable bays. The thermaltake v6 specs can be seen here.

Change System Hostname:

CentOS:

To change the hostname, the hostname is located in the following configuration file

/etc/sysconfig/network

The file contains three lines. We are only interested in changing the third linux beginning with hostname as this is the hostname. You can add whatever suits your fancy after the equals symbol.

NETWORKING=yes
NETWORKING_IPV6=no
HOSTNAME=bob

Then you need to restart the networking process, via the following command

# /etc/rc.d/init.d/network restart

Now you can restart the network services that control the hostname at startup. Manually starting the  above command should show you the results below.

Shutting down interface eth0:                             [  OK  ]
Shutting down loopback interface:                    [  OK  ]
Setting network parameters:                                [  OK  ]
Bringing up loopback interface:                          [  OK  ]
Bringing up interface eth0:                                   [  OK  ]

Now your hostname should be changed. You can check your hostname with the hostname command

# hostname
bob

Ubuntu:

Under ubuntu to change the hostname as of this writing using ubuntu version 10.04.03 you need to modify the following file

/etc/hostname

There will be one line with the name of the machine. Just change the name from what exists to the new name you want the machine to be called. There is a issue I have with ubuntu 10.04.03. It seems that the init script to restart the hostname does not work, nor the hostname service. The only way I have been able to get around this is to reboot the machine. This may be fixed in versions afterwards.

Creating a Software Raid Array in 600 seconds…

Recently I decided that I was going to build a array, after my disk failure on my previous server. This would allow my data to be redundant, even with a disk failure. I debated between hardware and software raid. Hardware raid would be faster, limited to one hardware controller. While with software raid or sometimes called fake raid. I can have the disks across multiple controllers. This again slows the performance of the software raid, but it is the tradeoff, I am willing to accept. I decided on software raid because, if a disk dies, and I cannot get a the same size. I can use a larger disk, and downsize the disk to the size of the other disks in the array.  Also with technology, larger disks do come down in price.

Ubuntu:

1. We need to first install the the raid software.

# apt-get install mdadm

2. Create the partitions on the hard disks.

# fdisk /dev/sda

Command (m for help): p

Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0xa3e937ed
Device Boot Start End Blocks Id System
/dev/sda1 1 60801 488384001 fd Linux raid autodetect

Next we need to change the partition type to “Linux raid auto”.

Command (m for help): t
Selected partition 1
fd  Linux raid auto
Hex code (type L to list codes): fd

3. Create the software raid array.

# mdadm –create /dev/md0 –chunk=4 –level=5 –raid-devices=3 /dev/sda1 /dev/sdb1 /dev/sdc1

–create creates the software array.
/dev/md0 is the name of the array, the array needs to be md[number]
–chunk the block size of the software array.
–raid-devices how many disks in the array.
/dev/sda1 is the disks that will be included in the array

4. Assemble the software raid array.

# mdadm –assemble /dev/md0 /dev/sda1 /dev/sdb1 /dev/sdc1

–assemble bundle the disks together.
/dev/md0 the name of the array.
/dev/sda1 the disks in the array.

5. To see the software raid sync you can use the following command.

# watch -n 10 cat /proc/mdstat

When the array is sync’ed it will have 100%. Time it takes depends on the size of the software array.

6. Create the file System upon the software array. You can partition the software array with fdisk.

# mkfs.ext3 /dev/md0

7. Now you can use the software disk array.

Itunes server in 600 seconds…

For the last few weeks I have been getting fustrated trying to access my music from my powermac and macbook pro to my ubuntu linux laptop. After some research via google, I found that linux had several itunes compatiable software that will run under linux. I decided on firefly media server Firefly media server is available for all flavours of unix, and had the most development and user base installed. Under Debian firefly had a package that I could just install, then just run the web interface. Here is the sequence of how I setup the itunes music server.

Ubuntu:
1. Install the itunes music server software

# apt-get install mt-daapd

2. Lets configure the mt-daapd configuration file.

# cd /etc

# vi mt-daapd.conf

The parts I edited are the location of where the music files are located.

mp3_dir = /storage/music

I also changed the password of the login.

admin_pw = mt-daapd

3. Now we need to restart the firefly server so the changes we made to the configuration file take effect.

# /etc/init.d/mt-daapd restart

4. Your can log into the web interface of the firefly music server. The location url will be http://machine:3689, enter your username and password. You can change any settings instead of editing your mt-daapd.conf on your server. 5. Within your supported application the itunes server with your music stored should now show up. If you have any issues make you can ping port 3689 of the server firefly is installed upon. Also check your firewall software. Now go ahead and enjoy streaming music across your network.

Creating a WebDav Server in Apache in 600 seconds…

Recently I started doing more web development, and decided instead of developing, my web ideas locally upon my machine, I could create a webdav upon my machine using debian packages, no compiling etc. To create this system, took me about 600 seconds in total. This is the sequence I took to create the webdav system.

Ubuntu:

1. Install apache2 package/software.

# apt-get install apache2

2. Activate the webdav modules within apache2.

# a2enmod dav_fs
# a2enmod dav

Now lets edit your apache default configuration. You can use a different virtualhost if you choose. I choose the default since my development server was upon a vmware instance. I built the instance just for web development work.

3. Go to the default configuration file of your apache2 for to modify for webdav usauge.

# cd /etc/apache2/sites-available

4. Now lets edit the configuration file.

# vi default

5. Edit your configuration file to reflect like mine below.

<VirtualHost *>
ServerAdmin webmaster@example.com
ServerName www.example.com
DocumentRoot /var/www
<Directory /var/www>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
ErrorLog /var/log/apache2/dev_error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog /var/log/apache2/machine.log combined
Alias /var/www
<Location /var/www>
DAV On
AuthType basic
AuthName “development”
AuthUserFile /var/www.passwd.dav
Require valid-user
</Location>
</VirtualHost>

Lets explain the parts of the configuration you need to know.

DocumentRoot /var/www

This is the top level directory where your web files reside.

<Directory /var/www>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>

This is the how this directory configuration, change if your need more, I left mine default.

Alias /share /var/www

This line above tells me if I want the call /var/www /dev/ upon my browser or application like dreamweaver etc. e.g. http://www.example.com/share

DocumentRoot /var/www

The about lines sets up the level of security. Since my server is a internal server only, I only used basic security.

<Location /var/www>
DAV On
AuthType Basic
AuthName “development”
AuthUserFile /var/www.passwd.dav
Require valid-user
</Location>

6. Next step is to create the password file that our users and there password is located.

# htpasswd -c /var/www/passwd.dav admin

You need to enter the password for the user, when the above command is entered.

7. We need to change the permissions of the passwd.dav file

# chown root:www-data /var/www/passwd.dav
# chmod 640 /var/www/webdav/passwd.dav

8. Now restart the apache2 webserver application.

# /etc/init.d/apache2 restart

9. Testing the application can be done via the application cadaver. We need to first get the

# apt-get install cadaver