Hi, today I would like to share you a
quick list of installing CENTOS 7 Linux for web development purposes which composed with Apache + PHP5.6 + MariaDB by the time of this writing.
I expected that you have already inserted the CD/DVD installer to your machine, formatted and partitioned. If not yet then please click this link first before you proceed to this tutorial.
Note: I frequently update this post whenever there are changes in my setup.
1.) yum update
2.) reboot
3.) rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY*
4.) yum -y install epel-release
5.) yum update
6.) yum -y install mariadb-server mariadb
7.) systemctl start mariadb.service
8.) systemctl enable mariadb.service
9.) mysql_secure_installation
10.)Enter current password for root (enter for none): <--ENTER
Set root password? [Y/n]
New password: <--yourmariadbpassword
Re-enter new password: <--yourmariadbpassword
Password updated successfully!
Reloading privilege tables..
... Success!
Remove anonymous users? [Y/n] <--ENTER
... Success!
Disallow root login remotely? [Y/n] <--ENTER
... Success!
Remove test database and access to it? [Y/n] <--ENTER
- Dropping test database...
... Success!
- Removing privileges on test database...
... Success!
Reload privilege tables now? [Y/n] <--ENTER
... Success!
11.) yum -y install httpd
12.) systemctl start httpd.service
13.) systemctl enable httpd.service
14.) Add port to pass through the firewall
#firewall-cmd --permanent --zone=public --add-service=http
#firewall-cmd --permanent --zone=public --add-port=5000/tcp
#firewall-cmd --permanent --zone=public --add-service=https
15.) Reload the firewall service for the changes to take effect
#firewall-cmd --reload
16.) Then check if the ports are already open/listening
#firewall-cmd --list-ports
17.) yum install wget
18.) http://www.techoism.com/how-to-upgrade-php-version-5-4-to-5-6-on-centosrhel/
php -v
rpm -Uvh https://mirror.webtatic.com/yum/el7/epel-release.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
19.) yum install -y php56w php56w-opcache php56w-xml php56w-mcrypt php56w-gd php56w-devel php56w-mysql php56w-intl php56w-mbstring php56w-soap php56w-xmlrpc
20.) systemctl restart httpd.service
21.) php -v
22.) nano /var/www/html/info.php
<?php
phpinfo();
?>
https://webtatic.com/packages/php56/
23.) Now reload http://192.168.0.100/info.php in your browser and scroll down to the modules section again. You should now find lots of new modules like curl etc there.:
24.) yum install phpMyAdmin
25.) nano /etc/httpd/conf.d/phpMyAdmin.conf
Now we configure phpMyAdmin. We change the Apache configuration so that phpMyAdmin allows connections not just from localhost (by commenting out the <Directory "/usr/share/phpmyadmin"> stanza):
[...]
Alias /phpMyAdmin /usr/share/phpMyAdmin
Alias /phpmyadmin /usr/share/phpMyAdmin
#<Directory /usr/share/phpMyAdmin/>
# <IfModule mod_authz_core.c>
# # Apache 2.4
# <RequireAny>
# Require ip 127.0.0.1
# Require ip ::1
# </RequireAny>
# </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>
<Directory /usr/share/phpMyAdmin/>
Options none
AllowOverride Limit
Require all granted
</Directory>
[...]
26.) nano /etc/phpMyAdmin/config.inc.php
[...]
$cfg['Servers'][$i]['auth_type'] = 'http'; // Authentication method (config, http or cookie based)?
[...]
27.) systemctl restart httpd.service
Afterwards, you can access phpMyAdmin under http://192.168.0.100/phpmyadmin/:
28.) Enabling Mod_Rewrite for WebApp
https://devops.profitbricks.com/tutorials/install-and-configure-mod_rewrite-for-apache-on-centos-7/
nano /etc/httpd/conf/httpd.conf
<Directory "/var/www/html">
Change "AllowOverride Off" to "AllowOverride All"
MySQL Login
mysql -u root -p
//Using password NO error
CREATE USER 'username'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON *.* TO 'username'@'localhost' WITH GRANT OPTION;
CREATE USER 'username'@'%' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON *.* TO 'username'@'%' WITH GRANT OPTION;
FLUSH PRIVILEGES;
PHP MEMORY
https://premium.wpmudev.org/blog/increase-memory-limit/?rad=b&utm_expid=3606929-86.PHoDXYJeQYmWFQIujGOFZg.1&utm_referrer=https%3A%2F%2Fwww.google.com%2F
nano /etc/php.ini
display_errors = On/Off
upload_max_filesize = 1000M
post_max_size = 2000M
memory_limit = 3000M
file_uploads = On
max_execution_time = 180
29.) firewall-cmd --permanent --zone=public --add-service=mysql
30.) firewall-cmd --reload
31.) yum install zip
yum install unzip
unzip pics.zip -d /tmp
http://www.cyberciti.biz/tips/how-can-i-zipping-and-unzipping-files-under-linux.html
References:
Apache: http://httpd.apache.org/
PHP: http://www.php.net/
MySQL: http://www.mysql.com/
CentOS: http://www.centos.org/
phpMyAdmin: http://www.phpmyadmin.net/
https://www.howtoforge.com/apache_php_mysql_on_centos_7_lamp