Using LINUX as a server?, if so please read below
Most of the Linux distros released as CD or DVD media for installing and if you install Linux with defualy options you get a nice user interface and a bunch of applications that you will never use in a server environment. Also default installation will require second, third CDs or all of seven CDs in one installation. But Linux, especially CentOS could be install with the first CD and the rest of the packages could be install with the installer “YUM”. For more security and reservation of resources the system must be installed with only base packages described below.
You don’t need to select the services that you will use in a server at the installation. The best choice is to unselect all the ticks you see on the installation screen as follows, we will install the necessay packages after the installation.
You won’t need any GUI in server mode or you should better get used to using terminal for better performance & security. Click Next when you done in this step and uncheck all prechecked items on all tabs. This way you should be able to install the OS with only one CD.
Install base packages after the reboot, most of the packages install dependencies, never mind installing them alone
yum install vixie-cron bind-utils jwhois which
If you need other packages instal them also. If you know the application but not the package containing it, you can always search it with the following command. For example, to install locate, you should.
yum whatprovides */locate
Yum will find the package (mlocate) for you easily.
Close IPv6 if you don’t use it (depreciated)
echo “alias net-pf-10 off” >> /etc/modprobe.conf
echo “alias ipv6 off” >> /etc/modprobe.conf
If you have your own log files in your custom directory and you want to rotate them daily, follow the directions below to create a custom logrotate script. In our example we will rotate the log files in folder /home/user/logs/ ending with *log:
vi /etc/logrotate.d/custom
and add the lines below to keep 8 days of log and compress them
/hsphere/user/logs/*log {
daily
rotate 8
missingok
compress
delaycompress
postrotate
/usr/sbin/apachectl graceful
endscript
}
For better performance you should use SSD disks, but you must take into account that SSD disks could be damaged if written all the time. Since EXT3 file system makes more utilization on disks more than EXT2, your disks might have a shorten life than expected. EXT3 makes journal of disks and some kind of defragmentation that you will never need in SSDs. Also Linux default file system uses atime to store last access time to a file, thus every read on a file makes a write and we will close this option as you rearly use it or you can find severeal other ways to see last access time if you need so. Also note that, do not try to convert EXT3 to EXT2 on a production server, edit /etc/fstab to disable atime:
/dev/sda1 / ext2 defaults 0 0
add noatime after all defaults:
/dev/sda1 / ext2 defaults,noatime 0 0
You can remount the disks by typing “mount -o remount,rw,noatime /dev/sda1” (sda1: replace with your appropriate disks) without writing to fstab (the changes will be lost on any reboot if you don’t write to fstab). To test the disk speeds you can call:
hdparm -tT /dev/sda1 # use df to see your disks instead of sda1
If you get less than 30 MB/s in “Timing buffered disk reads” part try to enable DMA or simply dispose your old disk and buy a new one.
Set 32 bit transfers and Interrupt mask in your disk.
New SATA disks, while promising huge speeds they came with minimum speed configurations in order to work on all type of systems including new and legacy. Such SATA3 devices promise to reach up to 6 Gbps (715 MB/s) but you can never see those results in your server. To see what your disk can do type the following command:
hdparm -I /dev/sda # use “df” to see your disks instead of sda
Commands/Features part of the result shows the options of your disk. the ones marked with (*) shows the options that you can set/unset. We will only show 32 bit transfers and interrupt masking here as an example, it is your own risk to set these features:
hdparm -tT /dev/sda # test speed before applying
hdparm -u1 -c3 /dev/sda
hdparm -tT /dev/sda