2009
09.21

Step 1: Installing SAMBA

 

Install Samba on your Ubuntu Server 

apt-get install samba

Edit you Aptitude source list so you can install Webmin (nice all-in tool for your Linux server)

vi /etc/apt/sources.list

Add the following line to the bottom of the sources.list

deb http://download.webmin.com/download/repository sarge contrib

Update your aptitude to check for changes in the sourcelist 

apt-get update

You need a GPG key for the signed repository. Go to a location to temporary download the key, like:

cd /root

Download the key by using the following command
wget http://www.webmin.com/jcameron-key.ascAdd the key for use with your repository
apt-key add jcameron-key.asc

 

Install Webmin

apt-get install webmin
 

Step 2: Configure SAMBA using the file /etc/samba/smb.conf

 

useradd %USERNAME% -m -n -c “Username”

-m stands for creating a homedrive

-n stands for creating the user with a default group instead of creating every user his own group

-c You can add the users Full Name as comment

passwd %USERNAME% {password for unix account}

 

smbpasswd -a %USERNAME% {create samba account for just created unix account}

 

Step 3: Configure SAMBA to work with ACL

 

When you set up a Samba server, you will need more than the ability to CHMOD files/directories. ACL is sort of an extended version of CHMOD, which almost has the same abilities as the file permissions on a Windows environment.

 

Install the ACL package:

 

apt-get install acl

 

modify your etc/fstab to allow ACL to give rights on the chosen filesystems:

 

vi /etc/fstab

 

Save the modified file and reboot the system.

To use ACL, you can use the command “getfacl“ and “setfacl“ 

You can use the helpfiles on how to use these commands.

2009
09.21

Officialy Kerio Mailserver isn’t supported to run on Ubuntu Server, however since the release of Version 6.7 they have downloadable .deb packages for Debian/Ubuntu. Using this tutorial you can create your own .deb package of the downloadable .rpm package and install Kerio on you Ubuntu Server:

 

# install kerio dependencies libstdc++5
apt-get install libstdc++5

# Install the created kerio_xxx-i386.deb. If you have trouble installing the .deb file with “dpkg -i filename.deb” try “dpkg –unpack filename.deb”.
dpkg -i kerio_xxx-i386.deb

# Start kerio configuration script and set your preferences.
cd /opt/kerio/mailserver
./cfgwizard

Now it is time to set proper init script see attached file. Download the file and paste it in /etc/init.d/. The file should be called keriomailserver. so Vi /etc/init.d/keriomailserver should give you this script.

#Set Kerio to start at bootup in rc.d. Do not forget the last dot!
update-rc.d keriomailserver start 99 2 3 4 5 . stop 20 0 1 6 .

Done! Do a reboot and see Kerio mailserver nicely start at bootup.

2009
09.21

I use Nagios for monitoring my critical servers/services for a while now. I thought about using Nagios to monitor my ESXi server(s) and found an article on the blog of  Carlos with a great way to monitor your ESXi’s in Nagios. Carlos created the scripts, however I want to give some more explanation about configuring your Nagios to run this scripts..

I will post a complete tutorial in here soon.

2009
09.21

A couple weeks ago I was looking for a solution to have a nice NAS solution at home. In stead of buying a Synology or Conceptronic NAS with some minor performance problems (because of them not having enough memory) I got the idea of creating my own NAS with SAMBA, OpenFiler or FreeNAS. Eventually, my idea of buying a NAS blowed up to the point where I wanted an ESXi server at home.

Because of traditional rackservers being expensive and noisy, I looked for a compatible towerserver for ESXi, however VMware isn’t easy when it comes to finding a compatible server.
I found a website named vm-help.com that has much info about ESXi whiteboxes (meaning a system not officially supported but perfectly able to run ESXi). Check this site if you are thinking about building your own ESXi server for a far better price than a supported vendor-server.
I also created a bootable ESXi USB-stick (which would be a little bit faster). Check this site for creating a bootable ESXi USB-stick.

Soon I will post the setup I used.

2009
09.21

I have SAMBA servers as print/file server at some companies. I created a back-up script for automated and compressed periodically back-ups. For the back-up I am using a cronjob:

—–

tar -zcvf /data/backup/”‘date ‘+%F”_DATA.tar.gz” /data/data > /data/rsync.log/’date +%F_%T’-DATA.txt

cd /data/backup

ls -1 | head -1 | xargs rm

—–

The first line creates a tarball named [date]_DATA.tar.gz (like 10-05-2009) in the /data/backup folder. The contents of the tarball is located at /data/data. The output of the tarball creation is saved to a log file in /data/rsync.log.

The second line changes the directory to the backupfolder.

The third line lists all the back-ups, outputs the first back-up (this will be the oldest back-up if you use the dateformat of the first line) and removes this back-up. This way you won’t have 90 back-ups after three months, if you only need 10 back-ups at any time.

You could also use the command find -type f -mtime which searches the back-ups using the creation attribute, so you can specify to filter for back-ups older than 10 days for example (in stead of using the third line of the above script, which is rather simple, the -mtime command is something I found out at a later stage). The next command will then delete these back-ups -exec rm {} \;

 

You will have to give the cronjob execute rights by using the following command chmod +x [filename].sh

 

use the command crontab -e and edit this to execute your cronjob on a daily basis (or anything you like). A little tutorial how to define cronjobs in crontab:
<minutes> <hours> <days> <months> <weekdays> <command>

EXAMPLE:

30    4         * *   *              Each day at 4:30
30    4-6       * *   *              Each day at 4:30, 5:30 and 6:30
30    4-8/2     * *   *              Each day at 4:30, 6:30 and 8:30
30    4,6,8     * *   *              Each day at 4:30, 6:30 and 8:30
*/10  8-16,22   * *   *              Every 10 minutes between 8:00 and 16:59 and between 22:00 and 22:59

Last but not least, you can also create an e-mailnotification. I use an e-mailprogram called sendEmail. You can install sendEmail using the apt-get install sendEmail command.
The following command can be inserted in the same cronjob as the ony for the above back-upscript:

cat /back-ups/log12.txt|sendEmail -f from@domain.com -t to@domain.com -s 192.168.1.10:25 -xu from@domain.com -xp ******* -u EMAILBACKUP to BACKUPSERVER -m

The above command lists the contents of a logfile called log12.txt in this example. It uses the sendEmail program and specifies from@domain.com as the sender address, to@domain.com as the receipt, 192.168.1.10:25 as the mailserver, from@domain.com as the authentication username, **** as the authentication password for the user, EMAILBACKUP to BACKUPSERVER as the subject, and the contents of the logfile as the message body.