在CentOS上配置LAMP(Linux, Apache, MySQL, PHP)环境并进行网络配置的步骤如下:
cat /etc/redhat-release
命令查看系统版本。systemctl status firewalld
systemctl stop firewalld
systemctl disable firewalld
getenforce
setenforce 0
vi /etc/selinux/config
将 SELINUX=enforcing
修改为 SELINUX=disabled
,保存并退出。yum -y install httpd httpd-manual mod_ssl mod_perl mod_auth_mysql
systemctl start httpd
systemctl enable httpd
rpm -Uvh http://dev.mysql.com/get/mysql57-community-release-el7-9.noarch.rpm
yum -y install mysql-community-server
systemctl start mysqld
systemctl enable mysqld
查看MySQL初始密码:
grep "password" /var/log/mysqld.log
运行 mysql_secure_installation
进行安全性配置。
yum install -y php php-mysql
创建一个 phpinfo.php
文件:
cd /var/www/html/
touch phpinfo.php
vi phpinfo.php
在文件中添加 <?php phpinfo(); ?>
,保存并退出。
cd /etc/sysconfig/network-scripts/
vi ifcfg-eth0
配置示例:DEVICE=eth0
BOOTPROTO=static
IPADDR=192.168.1.100
NETMASK=255.255.255.0
GATEWAY=192.168.1.1
DNS1=8.8.8.8
DNS2=8.8.4.4
ONBOOT=yes
systemctl restart network
ip addr show eth0
ping www.baidu.com
firewall-cmd --permanent --add-service=http
firewall-cmd --permanent --add-service=mysql
firewall-cmd --reload
hostnamectl set-hostname your_hostname
/etc/resolv.conf
文件,添加DNS服务器地址:nameserver 8.8.8.8
nameserver 8.8.4.4
通过以上步骤,您可以在CentOS系统上成功配置LAMP环境并进行网络配置。请根据您的实际需求调整配置参数。