1.裝python
需提前在usr/local目錄下創建安裝文件夾
[root ~]# yum install gcc
[root ~]# wget https://www.python.org/ftp/python/3.6.5/Python-3.6.5.tgz
[root ~]# gunzip Python-3.6.5.tgz
[root ~]# tar -xvf Python-3.6.5.tar
[root ~]# cd Python-3.6.5
[root ~]# ./configure --prefix=/usr/local/python36 --enable-optimizations
[root ~]# yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel
[root ~]# make && make install
...
[root ~]# ln -s /usr/local/python36/bin/python3.6 /usr/bin/python3
[root ~]# python3 --version
Python 3.6.5
這里可能需要手動配置pip軟連接:
ln -s /usr/local/python36/bin/pip /usr/bin/pip
ln -s /usr/local/python36/bin/pip3 /usr/bin/pip3
[root ~]# python3 -m pip install -U pip
[root ~]# pip3 --version
2.裝nginx
yum -y install nginx
設置nginx自啟動 或者可按以下鏈接安裝nginx
https://blog.csdn.net/qq_36886883/article/details/80674665
3.裝redis
[root ~]# wget http://download.redis.io/releases/redis-3.2.12.tar.gz
[root ~]# gunzip redis-3.2.12.tar.gz
[root ~]# tar -xvf redis-3.2.12.tar
[root ~]# cd redis-3.2.12
[root ~]# make && make install
[root ~]# redis-server --version
Redis server v=3.2.12 sha=00000000:0 malloc=jemalloc-4.0.3 bits=64 build=5bc5cd3c03d6ceb6
[root ~]# redis-cli --version
redis-cli 3.2.12
4.裝mysql
[root mysql]# ls
mysql-community-client-5.7.22-1.el7.x86_64.rpm
mysql-community-common-5.7.22-1.el7.x86_64.rpm
mysql-community-libs-5.7.22-1.el7.x86_64.rpm
mysql-community-server-5.7.22-1.el7.x86_64.rpm
[root mysql]# yum -y remove mariadb-libs
[root mysql]# yum -y install libaio
[root mysql]#rpm -ivh mysql-community-common-5.7.26-1.el7.x86_64.rpm
[root mysql]#rpm -ivh mysql-community-libs-5.7.26-1.el7.x86_64.rpm
[root mysql]#rpm -ivh mysql-community-client-5.7.26-1.el7.x86_64.rpm
[root mysql]#rpm -ivh mysql-community-server-5.7.26-1.el7.x86_64.rpm
檢測是否裝了mysql組件:
rpm -qa | grep -i mysql
刪除某個組件:
rpm -ev mysql-community-server-8.0.11-1.el7.x86_64;
也可按這個鏈接操作
https://blog.csdn.net/z13615480737/article/details/78906598
最有效的修改密碼方式:
需要在 /etc/my.cnf 中加入
use mysql
UPDATE user SET authentication_string=PASSWORD(’12345678′)WHERE user=’root’;
5.安裝git
直接yum安裝 或者按照以下博客安裝
https://www.cnblogs.com/imyalost/p/8715688.html
部署
在/etc/nginx下創建default.conf文件,在里面進行配置(最簡單的配置,也就是未做負載均衡的)
server {
listen 80;
server_name www.ling-weicommunity.top;
charset utf-8;
access_log /logs/access.log;
error_log /logs/error.log;
location / {
include uwsgi_params;
uwsgi_pass 127.0.0.1:8000;
uwsgi_param UWSGI_PYTHON /usr/bin/python3;
uwsgi_param UWSGI_CHDIR /CODE/lineup-app;
uwsgi_param UWSGI_SCRIPT lauch:app;
}
}
在項目中與lauch.py文件同級創建uwsgi.ini文件并寫入以下內容:
[uwsgi]
# uwsgi ?????????????????
socket = 127.0.0.1:8000
# pid???·??
pidfile = /CODE/lineup-app/uwsgi.pid
# ?????
chdir = /CODE/lineup-app
#????????
wsgi-file = /CODE/lineup-app/lauch.py
# ????????application???????
callable = app
# ???????С
buffer-size = 65536
# ????????
processes = 1
# ?????
threads = 2
# ???????
stats = 127.0.0.1:9000
# ??????????????
python-autoreload=1
# ?????????У???????????·??
daemonize = /CODE/lineup-app/flask.log
將源碼放入自定義文件夾,并執行pipenv install , 并進入虛擬環境(pipenv shell)
然后安裝uwsgi(pipenv install uwsgi)
直接查看小浦的博客文檔
http://47.103.198.17/article/detail/1567590187
docker安裝
參考這個博文
https://www.cnblogs.com/zhangyinhua/p/10286507.html
docker部署flask項目
參考此博文
https://blog.csdn.net/liudian_cz/article/details/88850773
查看linux某個項目日志中前十萬行中ip訪問次數最多的地址:
tail -10000 /var/log/nginx/log.log |
一條命令殺掉帶某關鍵字的進程,例如redis
ps -ef | grep redis | grep -v grep | awk ''