裸centos的一些安裝部署
1、安裝python-pip
首先安裝epel擴(kuò)展源:
yum -y install epel-release
更新完成之后,安裝pip:
yum -y install python-pip
2、安裝python依賴包:
初次直接運(yùn)行:
pip install -r requirement.list
如果是裸的centos絕對(duì)會(huì)報(bào)錯(cuò)!
然后開始漫長(zhǎng)的改錯(cuò)安裝。
### 錯(cuò)誤一:EnvironmentError: mysql_config not found
原因:缺少mysql驅(qū)動(dòng)導(dǎo)致,所以加上mysql就行
`yum -y install mysql-devel`
錯(cuò)誤二:error: command 'gcc' failed with exit status 1
原因:沒有g(shù)cc命令(c語言編譯器),沒有 那就安就行了
`yum -y install gcc`
但是還是會(huì)再次報(bào)錯(cuò):然后 我們需要安裝下
`yum -y install python-devel`
以上,就安裝完了依賴包。
3、安裝gunicorn
沒有別的就一個(gè):
`pip install gunicorn`
4、安裝supervisor
安裝命令
`easy_install supervisor`
驗(yàn)證是否成功:echo_supervisord_conf
然后mkdir /etc/supervisor
echo_supervisord_conf > /etc/supervisor/supervisord.conf
現(xiàn)在有配置文件還是不夠,我們需要擴(kuò)展,所以
mkdir /etc/supervisor/config.d
修改/etc/supervisor/supervisord.conf的最下面的一行include
files = /etc/supervisor/config.d/*.conf
最基本的配置:
[program:tomcat]
command=/opt/apache-tomcat-8.0.35/bin/catalina.sh run
directory=xxxx
autostart=true
autorestart=true
startsecs=5
priority=1
stopasgroup=true
killasgroup=true
5、安裝nginx
安裝各種依賴項(xiàng):
1、查看內(nèi)核版本,看看是否高于2.6。#2.6版本以上內(nèi)核才支持epoll
2、安裝GCC編譯器
yum -y install gcc
3、安裝C++編譯器
yum -y install gcc-c++
4、安裝PCRE庫 為了支持正則表達(dá)式
yum install -y pcre pcre-devel
5、安裝zlib庫
yum install -y zlib zlib-devel
6、安裝OpenSSL
yum install -y openssl openssl-devel
7、安裝nginx
yum -y install nginx
以上依賴環(huán)境全部安裝完成。
全部都安裝的命令:
yum -y install gcc gcc-c++ pcre pcre-devel zlib zlib-devel openssl openssl-devel nginx
6、設(shè)置系統(tǒng)時(shí)間
下載工具:ntp
yum -y install ntp
ntpdate -u asia.pool.ntp.org
rm -rf /etc/localtime
ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
7、設(shè)置supervisor為開機(jī)自啟動(dòng)
1、vim /lib/systemd/system/supervisord.service
2、
[Unit]
Description=Process Monitoring and Control Daemon
After=rc-local.service
[Service]
Type=forking
ExecStart=/usr/bin/supervisord -c /etc/supervisor/supervisord.conf
ExecReload=supervisorctl reload
[Install]
WantedBy=multi-user.target
3、systemctl enable supervisord.service
8、mysql遠(yuǎn)程授權(quán)訪問
GRANT ALL PRIVILEGES ON *.* TO root@"%" IDENTIFIED BY "password";
flush privileges;
[mysqld]
skip_name_resolve