yum安装PHP环境(lamp一键安装)

1.centos7默认将mariadb视作mysql(因为mysql被oracle收购后,原作者担心mysql闭源,所以又写了一个mariadb,卸载mariadb才能安装mysql)
2.卸载mariadb
列出所有被安装的rpm package再逐个删除       
rpm -qa | grep mariadb           
rpm -e --nodeps mariadb- libs-************.x86_64
3.官网下载安装mysql-server
wget http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
rpm -ivh mysql-community-release-el7-5.noarch.rpm
yum install mysql-community-server
4.安装Apache, PHP, MySQL以及php连接mysql库组件
yum -y install httpd php mysql mysql-server php-mysql
5.安装apache扩展        yum -y install httpd-manual mod_ssl mod_perl mod_auth_mysql
6.安装php的扩展         yum -y install php-gd php-xml php-mbstring php-ldap php-pear php-xmlrpc

7.安装MySQL的扩展       yum -y install mysql-connector-odbc mysql-devel libdbi-dbd-mysql


到这里yum安装LAMP环境就结束了;下面是安装过程中总结的笔记;不看也罢;

1.停止firewall          systemctl stop firewalld.service 
2.禁止firewall开机启动    systemctl disable firewalld.service 
3.配置开机启动服务 
/sbin/chkconfig httpd on 
/sbin/service httpd start
/sbin/service mysqld start
4.绑定域名
在/etc/httpd/conf/httpd.conf配置文件中设置
可以跟着如下提供的范例来配置
#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for requests without a known
# server name.
#
#<VirtualHost *:80>
#    ServerAdmin [email protected]
#    DocumentRoot /www/docs/dummy-host.example.com
#    ServerName dummy-host.example.com
#    ErrorLog logs/dummy-host.example.com-error_log
#    CustomLog logs/dummy-host.example.com-access_log common
#</VirtualHost>

总结:
1.apache的配置文件是/etc/httpd/conf下
  modules放在/usr/lib/httpd下
2.php的配置文件在/etc/php.d/下 
  /etc/php.iniphp的modules放在/usr/lib/php/modules下
3.MySQL默认安装的后,root密码为空
4.apache操作命令总结
启动apache      service httpd start   (systemctl start httpd.service)    
停止apache      service httpd stop    (systemctl stop httpd.service)
重启apache      service httpd restart (systemctl restart httpd.service)
5.mysql命令总结
开机启动        service mysql enable  (systemctl enable mysqld)
启动服务        service mysql start   (systemctl start mysqld)
重启服务        service mysql restart (systemctl restart mysqld)
6.初次安装mysql是root账户是没有密码的,设置密码的方法
<code class=" hljs vala"># mysql -u root
mysql> set password for root@localhost = password('123456');  //这里注意自己替换密码
mysql> exit</code>
7.创建一个可以从任何地方连接服务器的一个完全的超级用户,但是必须使用一个口令
<code class=" hljs applescript">mysql> grant all privileges on *.* to user@localhost identified by ‘123456’</code>

猜你喜欢

转载自blog.csdn.net/qq_33867131/article/details/79639186