第一步 关闭selinux以及防火墙,被这两个东西坑过很多次了
[root@localhost ~]# cat /etc/selinux/config # This file controls the state of SELinux on the system. # SELINUX= can take one of these three values: # enforcing - SELinux security policy is enforced. # permissive - SELinux prints warnings instead of enforcing. # disabled - No SELinux policy is loaded. SELINUX=disabled ###关闭selinux # SELINUXTYPE= can take one of three values: # targeted - Targeted processes are protected, # minimum - Modification of targeted policy. Only selected processes are protected. # mls - Multi Level Security protection. SELINUXTYPE=targeted [root@localhost ~]# getenforce Enforcing [root@localhost ~]# setenforce 0 #临时关闭 [root@localhost ~]# getenforce Permissive
[root@localhost ~]# systemctl status firewalld ● firewalld.service - firewalld - dynamic firewall daemon Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled) Active: active (running) since 六 2019-10-12 16:53:25 CST; 3 days ago Docs: man:firewalld(1) Main PID: 8309 (firewalld) CGroup: /system.slice/firewalld.service └─8309 /usr/bin/python -Es /usr/sbin/firewalld --nofork --nopid 10月 12 16:53:24 localhost.localdomain systemd[1]: Starting firewalld - dynamic firewall daemon... 10月 12 16:53:25 localhost.localdomain systemd[1]: Started firewalld - dynamic firewall daemon. [root@localhost ~]# systemctl stop firewalld [root@localhost ~]# systemctl disable firewalld Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service. Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
第二步 部署lamp或者lnmp环境,这里以部署lamp环境做演示。
首先apache的安装: 01 [root@localhost ~]# yum -y install httpd
接着mysql/mariadb的安装: yum install mysql mysql-server -y (yum install mariadb mariadb-server -y ,启动服务器后,输入mysql_secure_installation回车进行修改命令)
这里安装mariadb 02 [root@localhost ~]# yum install mariadb mariadb-server -y
然后php的安装:03 [root@localhost ~]# yum install php php-mysql php-devel -y
接着启动对应服务和设置开机自启
[root@localhost ~]# systemctl start httpd [root@localhost ~]# systemctl enable httpd Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service. [root@localhost ~]# systemctl start mariadb [root@localhost ~]# systemctl enable mariadb Created symlink from /etc/systemd/system/multi-user.target.wants/mariadb.service to /usr/lib/systemd/system/mariadb.service. [root@localhost ~]#