Finetune 1and1 dedicated server with CentOS

Although the start with 1&1 was not pleasant, I decided to stay with 1&1 and upgraded from a VPS to a dedicated server. (sadly, this VPS performance is much better than the dedicated server I got.) Now it is time to finetune it. The server came with CentOS, which is not my favourite, but it the best OS I can choose from the list.

The first thing to do is

yum update

I am using Ngnix instead of Apache, so turn off pre-installed Apache. Better to do it as the first thing, as I did not aware that httpd is running which prevented nginx from starting and wasted a lot of time to find the reason.
service httpd stop
chkconfig --level 235 httpd off

CentOS depository is missing lots of packages. I add two 3rd party repositories, epel (to get Nignx) and remi (to get the newest php 5.2.9).
rpm -Uvh http://download.fedora.redhat.com/pub/epel/5Server/x86_64/epel-release-5-3.noarch.rpm
rpm -Uvh http://rpms.famillecollet.com/enterprise/5/remi/x86_64/remi-release-5-7.el5.remi.noarch.rpm

Because I use try_files directive quite often in nginx conf files, but try_files starts from nginx 0.6.36, I can not use nginx 0.6.35 in epel repository. Luckly, epel-testing repository has nginx 0.6.36.
yum install nginx --enablerepo=epel-testing

The following commands are straight-forward.
yum install memcached
chkconfig --level 235 memcached on

yum install php-pecl-apc
yum install phpMyAdmin
yum install spawn-fcgi

I encounted difficulty install vim. First try is using yum install vim. It works on other CentOS I installed, aslo works with CentOS on 1&1 VPS, but just does not work on this 1&1 dedicated server. I do not know why. Nevertheless, the below listed command works.
yum install vim-enhanced

Because magento requires php 5.2.0 or above, but CentOS current php version is 5.1.6, it must be updated.
yum update php --enablerepo=remi

I saw some file conflicts from some mysql packages. To solve this problem,
cd /var/cache/yum/remi/packages
rpm -Uvh --force mysql<tab>

<tab> will automatically fill in the package file name.

mysql was up and running, but 1&1 did not tell me how to log into it. It took me a couple of hours to try different combinations of possible usernames and passwords before I gave up. Then I stopped mysqld, restarted it with
mysqld_safe --skip-grant-tables

Then I could go to user table in mysql database to reset root password. However, I found root as a username was not there. Instead, it is admin with all privileges.

So, I quitted mysql, restarted it in a normal way, tried to put in admin as username and the same password as server root user, it worked!

I changed the owner of php session directory (/var/lib/php/session) from apache to nginx, otherwise php could not start session without errors.

I expected the server would work by now, but it did not. It took me another hour to find out it was because php.ini of 1&1 dedicated server had
safe_mode default on

Just turn safe_mode off, because I do not need it. Now my lovely server is fully up.

Leave a Reply

Your email address will not be published. Required fields are marked *