Centeros 6 安裝 php7 apache mysql
不會的跟我一起操作
1.安裝 libmcrypt
cd /usr/local/src/
wget http://mirrors.hust.edu.cn/epel//6/x86_64/epel-release-6-8.noarch.rpm
rpm -ivh epel-release-6-8.noarch.rpm
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
yum install libmcrypt-devel
2.安裝apache
yum install httpd
service httpd start
chkconfig --levels 235 httpd on
3.安裝php7
rpm -Uvh http://mirror.webtatic.com/yum/el6/latest.rpm
yum -y install php70w php70w-mysql php70w-mbstring php70w-mcrypt php70w-gd php70w-imap php70w-ldap php70w-odbc php70w-pear php70w-xml php70w-xmlrpc php70w-pdo
4.安裝mysql,設定初始密碼
yum install mysql mysql-server mysql-devel -y
service mysqld start
mysqladmin -u root password '123456'
設定對外帳號
mysql -uroot -p
123456
GRANT ALL PRIVILEGES ON *.* TO someone@"%" IDENTIFIED BY "123456" WITH GRANT OPTION;
flush privileges;
預設安裝的是mysql5.1,如果要新版本5.7,這樣
wget https://dev.mysql.com/get/mysql57-community-release-el6-9.noarch.rpm
rpm -ivh mysql57-community-release-el6-9.noarch.rpm
yum install mysql-community-server
service mysqld start
mysql 5.7修改密碼
1.關閉mysqld
service mysqld stop
2.關閉安全
mysqld_safe --skip-grant-tables &
3.連線
mysql -p
4.改密碼
update mysql.user set authentication_string=password('123456') where user='root' and Host = 'localhost';
5.重新整理
flush privileges;
quit;
如果php的pdo連線mysql5.7報錯[Can't initialize character set utf8mb4],試試下面這2句(根據自己php版本修改)
yum erase php70w-mysql
yum install php70w-mysqlnd
5.配置apache
vim /etc/httpd/conf/httpd.conf
6.配置防火牆
iptables -A INPUT -p tcp -m state --state NEW -m tcp --dport 8080 -j ACCEPT
iptables -A INPUT -p tcp -m state --state NEW -m tcp --dport 3306 -j ACCEPT
service iptables save
cat /etc/sysconfig/iptables
修改順序
[root@localhost ~]# cat /etc/sysconfig/iptables
# Generated by iptables-save v1.4.7 on Sun Jun 11 15:51:06 2017
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [34:5240]
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 8080 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 3306 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
COMMIT
改完之後,策略並沒有直接生效,需要關閉重開一下
service iptables stop
service iptables start
相關文章
- php7安裝redis6擴充套件PHPRedis套件
- Windows下安裝 Apache PHP Mysql RedisWindowsApachePHPMySqlRedis
- ubuntu安裝php+mysql+apache2UbuntuPHPMySqlApache
- PHP7 編譯安裝PHP編譯
- Windows 10下安裝CenterOS 7雙系統WindowsROS
- linux下Apache+PHP+MySQL安裝配置攻略LinuxApachePHPMySql
- Debian安裝Apache2+MySQL5+PHP5ApacheMySqlPHP
- php7 安裝rabbitmq 擴充套件PHPMQ套件
- php7 安裝 imagick 擴充套件PHP套件
- PHP7 原始碼安裝 swoole 全流程PHP原始碼
- mac安裝apache flinkMacApache
- 下載安裝ApacheApache
- Apache Ranger安裝部署ApacheRanger
- apache編譯安裝Apache編譯
- Centos6 下安裝Nginx+Mysql+PHPCentOSNginxMySqlPHP
- 6.linux->MySQL 安裝及效能測試LinuxMySql
- CentOS6下mysql的安裝與配置CentOSMySql
- ubuntu16.04 PHP7安裝與Nginx PHPUbuntuPHPNginx
- 伺服器安裝Linux中安裝 Apache伺服器LinuxApache
- 安裝apache及介紹Apache
- CentOS 6.6安裝配置LAMP伺服器(Apache+PHP5+MySQL)CentOSLAMP伺服器ApachePHPMySql
- Mysql 5.7在OL 6上以RPM包安裝MySql
- mysql 安裝MySql
- 安裝mysqlMySql
- MySQL安裝MySql
- Linux安裝解除安裝MySQLLinuxMySql
- Linux伺服器---安裝apacheLinux伺服器Apache
- PHP安裝及與apache整合PHPApache
- CentOS 下編譯安裝 apacheCentOS編譯Apache
- CentOS 6.4 編譯安裝 apacheCentOS編譯Apache
- Apache安裝部署及工作模式Apache模式
- PHP7透過yum源安裝及效能測試PHP
- Linux伺服器下 php7安裝redis的方法Linux伺服器PHPRedis
- 連網安裝mysql與原始碼安裝mysqlMySql原始碼
- 【MySQL安裝】Linux下安裝MySQL(預編譯)MySqlLinux編譯
- 【推薦 - glibc安裝】MySQL - 安裝MySql
- MySQL 8.0.21下載安裝教程及Navicat for MySQL安裝MySql
- 安裝mysql和mysql workbenchMySql
- Apache安裝與最佳化教程。Apache