Install LAMP + phpMyAdmin on 7 CentOS 7 / RHEL
The main attention is now replaced by the MySQL database MariaDB, and therefore representative of the LAMP Linux + Apache + MariaDB + PHP up.
System: The new CentOS 7 using systemd, thus some instruction vary ; now use alternative MariaDB MySQL as the database software, there will also be installed directly MariaDB.
Set HOSTNAME
echo “HOSTNAME=clusterserver3.rmohan.com” >> /etc/sysconfig/network
hostname “clusterserver3.rmohan.com”
INSTALL VIM
yum -y install vim
To make a color display code, and also supports line numbers and mouse positioning mark, you need to edit vim configuration file:
vim /etc/vimrc
set nu
set mouse=a
update configuration file /etc/hosts
192.168.1.22 clusterserver3.rmohan.com clusterserver3
remove the dhcp
systemctl list-unit-files –type=service dhcp
add timezone
ln -sf /usr/share/zoneinfo/Singapore /etc/localtime
timedatectl set-timezone Asia/Singapore ; timedatectl
yum update
install http
yum install httpd
http://192.168.1.22
[root@clusterserver3 ~]# systemctl enable httpd
Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service.
[root@clusterserver3 ~]#
firewall-cmd –add-service=http –permanent
firewall-cmd –add-service=https –permanent
firewall-cmd –zone=public –add-port=22/tcp –permanent
systemctl restart firewalld
firewall-cmd –list-all
# firewall-cmd –state
# firewall-cmd –list-all
# firewall-cmd –list-interfaces
# firewall-cmd –get-service
# firewall-cmd –query-service service_name
# firewall-cmd –add-port=8080/tcp
install Mariadb
yum install mariadb-server mariadb
systemctl enable mariadb
[root@clusterserver3 ~]# systemctl enable mariadb
Created symlink from /etc/systemd/system/multi-user.target.wants/mariadb.service to /usr/lib/systemd/system/mariadb.service.
[root@clusterserver3 ~]#
top -u mysql
systemctl start mariadb
systemctl stop mariadb
systemctl restart mariadb
systemctl disable mariadb
systemctl is-active mariadb
Test MariaDB server in the local virtual machine CentOS 7 system, every time execution mysql command will always encounter “ERROR 2006 (HY000): MySQL server has gone away” error. Calibration of the time within a virtual machine, the aforementioned problems hours. Is there a necessary connection between the two is not to say, temporarily be recorded.
Execute an instruction casually in MariaDB, whether create database or just flush privileges or, before the implementation of the results will show a similar instruction such output,
MariaDB [(none)]> select now ();
ERROR 1305 (42000): FUNCTION now does not exist
MariaDB [(none)]>
mysql_secure_installation
[root@clusterserver3 ~]# mysql_secure_installation
/usr/bin/mysql_secure_installation: line 379: find_mysql_client: command not found
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!
In order to log into MariaDB to secure it, we’ll need the current
password for the root user. If you’ve just installed MariaDB, and
you haven’t set the root password yet, the password will be blank,
so you should just press enter here.
Enter current password for root (enter for none):
ERROR 1045 (28000): Access denied for user ‘root’@’localhost’ (using password: YES)
Enter current password for root (enter for none):
OK, successfully used password, moving on…
Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.
Set root password? [Y/n] Y
New password:
Re-enter new password:
Sorry, passwords do not match.
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
… Success!
By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.
Remove anonymous users? [Y/n] y
… Success!
Normally, root should only be allowed to connect from ‘localhost’. This
ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? [Y/n] y
… Success!
By default, MariaDB comes with a database named ‘test’ that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.
Remove test database and access to it? [Y/n] y
– Dropping test database…
… Success!
– Removing privileges on test database…
… Success!
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
Reload privilege tables now? [Y/n] y
… Success!
Cleaning up…
All done! If you’ve completed all of the above steps, your MariaDB
installation should now be secure.
Thanks for using MariaDB!
[root@clusterserver3 ~]#
MariaDB [(none)]> show global variables like ‘max_allowed_packet’;
+——————–+———+
| Variable_name | Value |
+——————–+———+
| max_allowed_packet | 1048576 |
+——————–+———+
1 row in set (0.00 sec)
MariaDB [(none)]>
MariaDB [(none)]> set global max_allowed_packet=1024*1024*16;
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> show global variables like ‘max_allowed_packet’;
+——————–+———-+
| Variable_name | Value |
+——————–+———-+
| max_allowed_packet | 16777216 |
+——————–+———-+
1 row in set (0.00 sec)
MariaDB [(none)]>
time in centos 7
yum -y -q install ntp
ntpdate -s ntp.org
date
MariaDB [(none)]> select now();
+———————+
| now() |
+———————+
| 2016-01-03 16:18:47 |
+———————+
1 row in set (0.00 sec)
MariaDB [(none)]>
Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.
MariaDB [(none)]> select now();
+———————+
| now() |
+———————+
| 2016-01-03 07:15:34 |
+———————+
1 row in set (0.00 sec)
MariaDB [(none)]>
yum install php
cp /etc/php.ini ~/confbak/php.ini.bak
cp /etc/httpd/conf.d/php.conf ~/confbak/httpd/conf.d/php.conf.bak
cp /etc/httpd/conf.modules.d/10-php.conf ~/confbak/httpd/conf.modules.
vi /etc/php.ini
error_reporting = E_COMPILE_ERROR|E_RECOVERABLE_ERROR|E_ERROR|E_CORE_ERROR
display_errors = Off
log_errors = On
max_execution_time = 300
memory_limit = 32M
yum install php-mysql
yum install http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7
yum install phpmyadmin
cp /etc/httpd/conf.d/phpMyAdmin.conf ~/confbak/httpd/conf.d/phpMyAdmin.conf.bak
#Alias /phpMyAdmin /usr/share/phpMyAdmin
#Alias /phpmyadmin /usr/share/phpMyAdmin
<Directory /usr/share/phpMyAdmin/>
………
</Directory>
Require ip 127.0.0.1
Require ip ::1
cp /etc/phpMyAdmin/config.inc.php ~/confbak/config.inc.php.bak
vi /etc/phpMyAdmin/config.inc.php
$cfg[‘blowfish_secret’] = ‘password’
systemctl restart httpd
Recent Comments