This guide shows howto install Apache HTTP Server (httpd) with PHP 5.5.9 and following modules on Fedora 20/19/18/17, CentOS 6.5/6.4/6.3/6.2/6.1/6/5.10 and Red Hat (RHEL) 6.5/6.4/6.3/6.2/6.1/6/5.10 systems.
- Change root user
su -
## OR ##
sudo -i
- Install Remi repository
Fedora
## Remi Dependency on Fedora 20 / 19 / 18 / 17 ##
rpm -Uvh http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-stable.noarch.rpm
rpm -Uvh http://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-stable.noarch.rpm
## Fedora 20 ##
rpm -Uvh http://rpms.famillecollet.com/remi-release-20.rpm
## Fedora 19 ##
rpm -Uvh http://rpms.famillecollet.com/remi-release-19.rpm
## Fedora 18 ##
rpm -Uvh http://rpms.famillecollet.com/remi-release-18.rpm
## Fedora 17 ##
rpm -Uvh http://rpms.famillecollet.com/remi-release-17.rpm
CentOS and Red Hat (RHEL)
## Remi Dependency on CentOS 6 and Red Hat (RHEL) 6 ##
rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
## CentOS 6 and Red Hat (RHEL) 6 ##
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
## Remi Dependency on CentOS 5 and Red Hat (RHEL) 5 ##
rpm -Uvh http://dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm
## CentOS 5 and Red Hat (RHEL) 5 ##
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-5.rpm
- Install Apache (httpd) Web server and PHP 5.5.9
Fedora 20/19
yum --enablerepo=remi install httpd php php-common
Fedora 18/17
yum --enablerepo=remi,remi-test install httpd php php-common
CentOS 6.5/5.10 and Red Hat (RHEL) 6.5/5.10
yum --enablerepo=remi,remi-php55 install httpd php php-common
- Install PHP 5.5.9 modules
Select what you need: APC, CLI, PEAR, PDO, MySQL, PostgreSQL, MongoDB, SQLite, Memcache, Memcached, GD, MBString, MCrypt, XML More info about PHP APC from PHP APC Configuration and Usage Tips and Tricks.
Fedora 20/19
yum --enablerepo=remi install php-pecl-apc php-cli php-pear php-pdo php-mysqlnd php-pgsql php-pecl-mongo php-sqlite php-pecl-memcache php-pecl-memcached php-gd php-mbstring php-mcrypt php-xml
Fedora 18/17
yum --enablerepo=remi,remi-test install php-pecl-apc php-cli php-pear php-pdo php-mysqlnd php-pgsql php-pecl-mongo php-sqlite php-pecl-memcache php-pecl-memcached php-gd php-mbstring php-mcrypt php-xml
CentOS 6.5/5.10 and Red Hat (RHEL) 6.5/5.10
yum --enablerepo=remi,remi-php55 install php-pecl-apc php-cli php-pear php-pdo php-mysqlnd php-pgsql php-pecl-mongo php-sqlite php-pecl-memcache php-pecl-memcached php-gd php-mbstring php-mcrypt php-xml
- Start Apache HTTP server (httpd) and autostart Apache HTTP server (httpd) on boot
/etc/init.d/httpd start ## use restart after update
## OR ##
service httpd start ## use restart after update
## Fedora ##
systemctl enable httpd.service
## CentOS / RHEL ##
chkconfig --levels 235 httpd on
- Create test PHP page to check that Apache, PHP and PHP modules are working
Add following content to /var/www/html/test.php file.
<?php
phpinfo();
- Check created page with browser
Access following address, with your browser. http://localhost/test.php
Enable Remote Connection to Apache HTTP Server (httpd) –> Open Web server Port (80) on Iptables Firewall (as root user again)
-
CentOS/Red Hat (RHEL)
-
Edit /etc/sysconfig/iptables file:
nano -w /etc/sysconfig/iptables
-
Add following INPUT rule:
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
-
Restart Iptables Firewall:
service iptables restart ## OR ## /etc/init.d/iptables restart
-
Fedora
-
Add New Rule to Firewalld:
firewall-cmd --permanent --zone=public --add-service=http ## OR ## firewall-cmd --permanent --zone=public --add --port=80/tcp
-
Restart Iptables
systemctl restart iptables.service
-
Test remote connection Access following address, with your browser. http://your.domain/test.php
yum --enablerepo=remi install mysql mysql-server
After installing MysQL server packages, start the service and execute following command for applying initial security. Execute below command and follow the instructions.
service mysqld start
Execute mysql_secure_installation script and follow the wizard. It will prompt for root password. To get temporary root password check ‘/root/.mysql_secret’ file
/usr/bin/mysql_secure_installation
Autostart MySQL on boot
chkconfig mysqld on
Now you have successfully installed MySQL. Login to MySQL using root access and try to create a dummy database. The root user password can be found in /root/.mysql_secret.
mysql -u root -p
Create a dummy database using following command.
mysql> create database dummydb;
Query OK, 1 row affected (0.01 sec)
phpMyAdmin is a free open source web interface tool, used to manage your MySQL databases. By default phpMyAdmin is not found in CentOS official repositories. So let us install it using EPEL repository.
To install EPEL repository, follow the below link:
Now install phpMyAdmin
yum install phpmyadmin -y
Configure phpMyAdmin Edit the phpmyadmin.conf file.
vi /etc/httpd/conf.d/phpMyAdmin.conf
Find and comment the whole / section as shown below:
[...]
Alias /phpMyAdmin /usr/share/phpMyAdmin
Alias /phpmyadmin /usr/share/phpMyAdmin
#<Directory /usr/share/phpMyAdmin/>
# <IfModule mod_authz_core.c>
# # Apache 2.4
# Require local
# </IfModule>
# <IfModule !mod_authz_core.c>
# # Apache 2.2
# Order Deny,Allow
# Deny from All
# Allow from 127.0.0.1
# Allow from ::1
# </IfModule>
#</Directory>
[...]
Open “config.inc.php” file and change from “cookie” to “http” to change the authentication in phpMyAdmin:
cp /usr/share/phpMyAdmin/config.sample.inc.php /usr/share/phpMyAdmin/config.inc.php
vi /usr/share/phpMyAdmin/config.inc.php
Change cookie to http.
[...]
/* Authentication type */
$cfg['Servers'][$i]['auth_type'] = 'http';
[...]
Restart the Apache service:
service httpd restart
Now you can access the phpmyadmin console by navigating to http://server-ip-address/phpmyadmin/ from your browser.
Enter your MySQL username and password which you have given in previous steps. In my case its “root” and “centos”.
Now you will able to manage your MariaDB databases from phpMyAdmin web interface.
wget http://download.redis.io/releases/redis-2.8.6.tar.gz
tar -zxvf redis-2.8.6.tar.gz
cd redis-2.8.6
make
Once you installed it without any error move two Redis files into the /usr/local/bin/ directory...
cd src
cp redis-server /usr/local/bin/
cp redis-cli /usr/local/bin/
Now time to move default init script and configuration file's.
cd utils/
cp redis_init_script /etc/init.d/redis
cd ..
cp redis.conf /etc/
After that edit the redis.conf file and make certain changes.
vi /etc/redis.conf
- Set daemonize yes
- Set bind to loop back ip address[127.0.0.1]
- Set logfile /var/log/redis.log default set to /dev/null
- Set pidfile /var/run/redis.pid
- Set LogLevel to Debug to debug issue
- Set the number of databases on a per connection basis. The default value is 0
- Set maxmemory as per requirement.
Now download install and configure phpredis
git clone git://github.com/nicolasff/phpredis.git
cd phpredis
phpize
./configure
make && make install
Edit create redis.ini into the /etc/php.d/ directory. Add extensions redis.so in file.
extension=redis.so
Redis installation is completed
Restart Apache
service httpd restart