Nginx
MYSQL5.7
PHP7
Nginx latest
- 配置epel yum 源
shell>wget http://dl.Fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
shell>rpm -ivh epel-release-latest-7.noarch.rpm
- 配置nginx
shell>yum install nginx -y
- 啟動nginx
shell>systemctl start nginx
- 設(shè)置開機(jī)啟動
shell>systemctl enable nginx
MYSQL5.7
- 安裝mysql源
shell>yum localinstall mysql57-community-release-el7-8.noarch.rpm
- 檢查mysql源是否安裝成功
shell>yum repolist enabled | grep "mysql.*-community.*"
看到上圖所示表示安裝成功谤专。
可以修改源vim /etc/yum.repos.d/mysql-community.repo
瘟芝,改變默認(rèn)安裝的mysql版本瞬内。比如要安裝5.6版本舅柜,將5.7源的enabled=1
改成enabled=0
舆蝴。然后再將5.6源的enabled=0
改成enabled=1
即可。改完之后的效果如下所示:
- 安裝MySQL
shell>yum install mysql-community-server
- 啟動MySQL服務(wù)
shell>systemctl start mysqld
● mysqld.service - MySQL Server
Loaded: loaded (/usr/lib/systemd/system/mysqld.service; disabled; vendor preset: disabled)
Active: active (running) since 五 2016-06-24 04:37:37 CST; 35min ago Main PID: 2888 (mysqld)
CGroup: /system.slice/mysqld.service
└─2888 /usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid
6月 24 04:37:36 localhost.localdomain systemd[1]: Starting MySQL Server...
6月 24 04:37:37 localhost.localdomain systemd[1]: Started MySQL Server.- 開機(jī)啟動
shell>systemctl enable mysqld
shell>systemctl daemon-reload
- 修改root本地登錄密碼
mysql安裝完成之后,在/var/log/mysqld.log文件中給root生成了一個默認(rèn)密碼。通過下面的方式找到root默認(rèn)密碼矩距,然后登錄mysql進(jìn)行修改:
shell>grep 'temporary password' /var/log/mysqld.log
shell>mysql -uroot -p
mysql>ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass4!’;
或者
mysql>set password for 'root'@'localhost'=password('MyNewPass4!');
注意:mysql5.7默認(rèn)安裝了密碼安全檢查插件(validate_password),默認(rèn)密碼檢查策略要求密碼必須包含:大小寫字母怖竭、數(shù)字和特殊符號锥债,并且長度不能少于8位。否則會提示ERROR 1819 (HY000): Your password does not satisfy the current policy requirements錯誤- 添加遠(yuǎn)程登錄用戶
默認(rèn)只允許root帳戶在本地登錄痊臭,如果要在其它機(jī)器上連接mysql哮肚,必須修改root允許遠(yuǎn)程連接,或者添加一個允許遠(yuǎn)程連接的帳戶趣兄,為了安全起見绽左,我添加一個新的帳戶:
mysql>GRANT ALL PRIVILEGES ON *.* TO 'dbadmin'@'%' IDENTIFIED BY 'DBadmin123456!' WITH GRANT OPTION;
mysql>flush privileges;
PHP7
- 安裝epel-release
shell>rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
- 安裝PHP7的rpm源
shell>rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
- 安裝PHP7
shell>yum install php71w php71w-cli php71w-common php71w-devel php71w-embedded php71w-fpm php71w-gd php71w-mbstring php71w-mysqlnd php71w-opcache php71w-pdo php71w-xml
- 配置PHP
shell>vim /etc/php.ini
添加配置date.timezone=PRC expose_php=Off default_charset = "UTF-8"
- 配置PHP-fpm
shell>vim /etc/php-fpm.d/www.conf
- 啟動php-fpm
shell>systemctl start php-fpm
Git安裝
- 下載編譯工具
shell>yum -y groupinstall "Development Tools"
- 下載依賴包
shell>yum -y install zlib-devel perl-ExtUtils-MakeMaker asciidoc xmlto openssl-devel
- 下載 Git 最新版本的源代碼
shell>wget https://www.kernel.org/pub/software/scm/git/git-2.18.0.tar.gz
- 解壓
shell>tar -zxvf git-2.18.0.tar.gz
- 進(jìn)入目錄配置
shell>cd git-2.18.0
shell>./configure --prefix=/usr/local/git
- 安裝
shell>make && make install
- 配置全局路徑
shell>export PATH="/usr/local/git/bin:$PATH"
shell>source /etc/profile
shell>PATH=$PATH:/usr/libexec/git-core
- 查看git版本
shell>git --version
PHP擴(kuò)展
- 安裝yaf
shell>wget -c http://pecl.php.net/get/yaf-3.0.7.tgz
shell>tar -zxvf yaf-3.0.7.tgz
shell>cd yaf-3.0.7
shell>phpize
shell>./configure
shell>make && make install
shell>vim /etc/php.ini
添加extension=yaf.so
重啟服務(wù)
shell>service php-fpm restart
shell>service nginx restart
shell>php -m
(查看安裝的擴(kuò)展)
- 安裝phpredis
shell>git clone https://github.com/phpredis/phpredis
shell>cd phpredis
shell>phpize
shell>./configure
shell>make && make install
shell>vim /etc/php.ini
添加extension=redis.so
安裝swoole
shell>wget -c https://github.com/swoole/swoole-src/archive/v2.1.3.tar.gz
shell>tar -zxvf v2.1.3.tar.gz
shell>cd v2.1.3.tar
shell>phpize
shell>./configure
shell>make && make install
shell>vim /etc/php.ini
添加extension=swoole.so
安裝redis
shell>yum install redis
shell>bind 127.0.0.1 ->bind 0.0.0.0
shell>requirepass ->requirepass xxxx
安裝出現(xiàn)進(jìn)程問題
shell>
rm -f /var/run/yum.pid