Web server on centos 6
Written by Friends Wednesday, 04 December 2013 16:32
Here is a quick how to guide on setting up a web server on Centos 6
Run this script…
sudo yum update -y sudo yum install httpd -y sudo yum install php-mysql php php-xml php-mcrypt php-mbstring php-cli php-gd mysql -y sudo yum install php-devel -y
sudo yum install mysql-server -y sudo yum install openssh-clients -y sudo yum install wget -y wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm wget http://rpms.famillecollet.com/enterprise/remi-release-6.rpm sudo rpm -Uvh remi-release-6*.rpm epel-release-6*.rpm
### Once installed you should see some additional repo definitions under the /etc/yum.repos.d directory. ###
ls -1 /etc/yum.repos.d/epel* /etc/yum.repos.d/remi.repo
### You should see:
/etc/yum.repos.d/epel.repo /etc/yum.repos.d/epel-testing.repo /etc/yum.repos.d/remi.repo
### Enable the remi repository ###
The remi repository provides a variety of up-to-date packages that are useful or are a requirement for many popular web-based services. That means it generally is not a bad idea to enable the remi repositories by default.
First, open the /etc/yum.repos.d/remi.repo repository file using a text editor of your choice:
sudo vi /etc/yum.repos.d/remi.repo
### Edit the [remi] portion of the file so that the enabled option is set to 1. This will enable the remi repository. ###
name=Les RPM de remi pour Enterprise Linux $releasever - $basearch #baseurl=http://rpms.famillecollet.com/enterprise/$releasever/remi/$basearch/ mirrorlist=http://rpms.famillecollet.com/enterprise/$releasever/remi/mirror enabled=1 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi failovermethod=priority
### Install mcrypt ##############
sudo yum -y install php-mcrypt
### adjusting apache config ###
sudo vi /etc/httpd/conf/httpd.conf
### Scroll all the way down the the bottom of the Config file by pressing G (Shift + g) then press “a” so you can start manipulating the file.
### paste the following 4 lines and adjust the document root and the ip address
DocumentRoot /var/www/html ServerName 1.2.3.4
### Sroll up until you find ###
DirectoryIndex and replace with the following line:
DirectoryIndex index.html index.php index.sh default.jsp
### make sure DocumentRoot is set to
/var/etc/html
### Remove # infront of NameVirtualHost
the press “Esc” and then type ZZ (two capital Z’s)
### Finally, start the Apache server using the command:
sudo service httpd start
################# Configuring MySQL #############################
#run:
sudo service mysqld start /usr/bin/mysql_secure_installation
############# moving Mysql database to new server ###############################
mysqldump -u username -password databasename > dump.sql mysql -u username -password databasename < dump.sql