Install LAMP Server in 1and1
LAMP

Linux: Cantos release 5.8
Apache:  Apache/2.2.3
MYSQL: 5.0.95
PHP: 5.2.10

1and1 Server provides predefines LVM Model like This:

[root@u1XXXX980 ~]# df –h

Filesystem                                           Size       Used     Avail     Use%     Mounted on
/dev/md1                                             4.0G      749M     3.3G      19%        /
/dev/mapper/vg00-usr                   4.0G     1.6G        3.4G      40%        /usr
/dev/mapper/vg00-var                                   4.0G     1.3G        3.7G       32.5%   /var
/dev/mapper/vg00-home             4.0G     1G           3.0G      25 %       /home

You need to extend the logical volume follow the step which is provided by 1and1 FAQ


some time the LVM Extended successfully
but resize2fs got error name as error with super block

make sure the LVM all command will available in LVM prompt.
Type lvm and you will got the promt like this:
lvm> help

type help and you will able to view all commands, make sure tune4fs command will be found there. If not install e4fsprogs package to get this command [ yum install e4fsprogs]
and run this fsadm resize command to resize the lvm

Example :
fsadm resize /dev/vg00/usr

after the successfully extended the LVM you can proceed to further installation.

 Install development tool

# yum groupinstall "Development Tools" "Development Libraries"

Install and configure Apache Server

# yum install httpd httpd-devel mod_ssl –y
# vi /etc/httpd/conf/httpd.conf

Add this line at the end of the file

NameVirtualHost *:80
NameVirtualHost *:443
Include /etc/httpd/conf/vhosts

Save and exit

# mkdir vhosts
# cd vhosts
# vi mywebsite.com

<VirtualHost *:80>
DocumentRoot /var/www/vhosts/mywebsite.com/httpdocs
ServerName mywebsite.com
ServerAlias www.mywebsite.com
ServerAdmin support@mywebsite.com
CustomLog /var/log/mywebsite.com-access_log combined_forwarded
ErrorLog /var/log/ mywebsite.com-error_log

<Directory "/var/www/vhosts/mywebsite.com/httpdocs">
Options FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>

# mkdir –p /var/www/vhosts/mywebsite.com/httpdocs

# echo “welcome to mywebsite” > /var/www/vhosts/mywebsite.com/httpdocs/index.html


Install NTP and configure NTP Server
# yum install ntp
# chkconfig ntpd on
# ntpdate pool.ntp.org
# /etc/init.d/ntpd start

# Install and configure MYSQL Server
# yum install mysql mysql-server –y


For the optimization of MYSQL Server

# vi /etc/my.cnf

[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

[mysqld]
log-bin=mysql-bin
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
skip-locking
#skip-networking
safe-show-database
query_cache_limit=1M
query_cache_size=512M ## 32MB for every 1GB of RAM
query_cache_type=1
max_user_connections=200
max_connections=500
interactive_timeout=10
wait_timeout=60
connect_timeout=20
thread_cache_size=128
key_buffer=1024M ## 64MB for every 1GB of RAM
join_buffer=4M
max_connect_errors=20
max_allowed_packet=16M
table_cache=1024
record_buffer=1M
sort_buffer_size=16M ## 1MB for every 1GB of RAM
read_buffer_size=16M ## 1MB for every 1GB of RAM
read_rnd_buffer_size=16M  ## 1MB for every 1GB of RAM
thread_concurrency=8 ## Number of CPUs x 2
myisam_sort_buffer_size=64M
server-id=1
log_slow_queries=/var/log/mysql-slow-queries.log
#long_query_time=2
collation-server=latin1_general_ci
old-passwords=1
innodb_buffer_pool_size=1000M
innodb_additional_mem_pool_size=200M
ft_min_word_len = 3

[mysql.server]
user=mysql
basedir=/var/lib

[safe_mysqld]
err-log=/var/log/mysqld.log
pid-file=/var/lib/mysql/mysql.pid
open_files_limit=8192

[mysqldump]
quick
max_allowed_packet=16M

[mysql]
no-auto-rehash
#safe-updates

[isamchk]
key_buffer=32M
sort_buffer=32M
read_buffer=16M
write_buffer=16M

[myisamchk]
key_buffer=32M
sort_buffer=32M
read_buffer=16M
write_buffer=16M

[mysqlhotcopy]
interactive-timeout


# run the MYSQL secure installation command

And disable remote root login , remove test database and test user and set db-root password

# service mysqld start

# chkconfig mysqld on

# mysql –uroot –p

#  mysql> create database databasename;

mysql> use create database;

mysql> use databasename;

mysql> source databasename.sql;

mysql> GRANT ALL ON databasename.* TO username@localhost IDENTIFIED BY 'p@ssw0rd';

or

mysql> GRANT ALL ON databasename.* TO username@192.168.1.19 IDENTIFIED BY 'p@ssw0rd';

# Install PHP 5.2.10
Download the rpm package from

install php-cli , php-common first and after that install php-5.2.10

 after the PHP installation restart start the httpd server and make it permanent.

To test the PHP

# vi /var/www/vhosts/mywebsite/httpdocs/phpinfo.php

<?php
phpinfo();
?>


It will show the php loded modules


Now you can restore the codebase of the application.

Comments