https://www.cnblogs.com/pyyu/p/9481344.html

 

 

 

1,开机初始化的配置
iptables -F 清空防火墙
/etc/init.d/iptables stop  #关闭iptables
setenforce 0  #暂停selinux

#编译安装python3

环境准备
yum install gcc patch libffi-devel python-devel  zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel -y

#下载python3的源码包
wget https://www.python.org/ftp/python/3.4.7/Python-3.4.7.tar.xz
#解压缩源码包
xz -d Python-3.4.7.tar.xz
tar -xf Python-3.4.7.tar 
#切换python3目录 
cd Python
-3.4.7
#释放脚本文件
.
/configure --prefix=/opt/python347
#编译,编译安装
make
&& make install
#建立软连接
ln
-s /opt/python347/bin/python3 /usr/local/bin/python3
#将编译的python3的环境变量添加到pATH
vim
/etc/profile
#写入到配置文件,永久生效 在最底行写入
export PATH
=$PATH:/opt/python347/bin/ 然后 source /etc/profile
使得配置文件生效
#python解释器的自动补全功能 yum install
-y readline-devel -y pip install readline import readline,rlcompleter readline.parse_and_bind('tab:complete')
#python虚拟环境 virtualenv
--no-site-packages venv
#创建venv虚拟环境 #激活虚拟环境 source venv
/bin/activate
#虚拟环境主要是对环境变量进行更改 echo $PATH
#退出虚拟环境 deactivate #ipython pip3 install ipython
#交互式的解释器 #notebook pip3 install notebook

 

 

安装python

1,开机初始化的配置
iptables -F 清空防火墙
/etc/init.d/iptables stop  #关闭iptables
setenforce 0  #暂停selinux

#编译安装python3

环境准备
yum install gcc patch libffi-devel python-devel  zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel -y

#下载python3的源码包
wget https://www.python.org/ftp/python/3.4.7/Python-3.4.7.tar.xz
#解压缩源码包
xz -d Python-3.4.7.tar.xz
tar -xf Python-3.4.7.tar
#切换python3目录
cd Python-3.4.7
#释放脚本文件
./configure --prefix=/opt/python347
#编译,编译安装
 make && make install 
 #建立软连接
 ln -s /opt/python347/bin/python3 /usr/local/bin/python3

下载 readline
 yum install -y readline -devel


查看环境变量:

[root@tencentcloud ~]# echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin




 

 

 虚拟环境的安装

#python虚拟环境
virtualenv --no-site-packages venv #创建venv虚拟环境
#激活虚拟环境
source venv/bin/activate
#虚拟环境主要是对环境变量进行更改
echo $PATH
#退出虚拟环境
deactivate

 

 

1. 下载NGINX 

wget http://nginx.org/download/nginx-1.14.0.tar.gz

2.解压

tar xf nginx-1.14.0.tar.gz 

3. 编译安装三部曲 

 

进入 nginx 目录下 ,注意目录里有个configure 文件
./configure --prefix=/opt/nginx-1.14.0

make && make install

 

4.开启服务

4.启动nginx,进入sbin目录,找到nginx启动命令
cd sbin
./nginx #启动
./nginx -s stop #关闭
./nginx -s reload #重新加载

5.查看conf文件

cat conf/nginx.conf
[root@tencentcloud nginx-1.12.2]# cat conf/nginx.conf

#user  nobody;
worker_processes  1;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

#pid        logs/nginx.pid;


events {
    worker_connections  1024;
}


http {
    include       mime.types;
    default_type  application/octet-stream;

    #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
    #                  '$status $body_bytes_sent "$http_referer" '
    #                  '"$http_user_agent" "$http_x_forwarded_for"';

    #access_log  logs/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;

    #gzip  on;

    server {
        listen       80;
        server_name  localhost;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        location / {
            root   html;
            index  index.html index.htm;
        }

        #error_page  404              /404.html;

        # redirect server error pages to the static page /50x.html
        #
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }

        # proxy the PHP scripts to Apache listening on 127.0.0.1:80
        #
        #location ~ \.php$ {
        #    proxy_pass   http://127.0.0.1;
        #}

        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        #
        #location ~ \.php$ {
        #    root           html;
        #    fastcgi_pass   127.0.0.1:9000;
        #    fastcgi_index  index.php;
        #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
        #    include        fastcgi_params;
        #}

        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        #location ~ /\.ht {
        #    deny  all;
        #}
    }


    # another virtual host using mix of IP-, name-, and port-based configuration
    #
    #server {
    #    listen       8000;
    #    listen       somename:8080;
    #    server_name  somename  alias  another.alias;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}


    # HTTPS server
    #
    #server {
    #    listen       443 ssl;
    #    server_name  localhost;

    #    ssl_certificate      cert.pem;
    #    ssl_certificate_key  cert.key;

    #    ssl_session_cache    shared:SSL:1m;
    #    ssl_session_timeout  5m;

    #    ssl_ciphers  HIGH:!aNULL:!MD5;
    #    ssl_prefer_server_ciphers  on;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}

}
View Code

相关文章:

  • 2022-01-22
  • 2022-12-23
  • 2021-10-02
  • 2022-12-23
  • 2022-12-23
  • 2021-08-31
  • 2021-12-05
猜你喜欢
  • 2021-08-27
  • 2022-03-10
  • 2022-12-23
  • 2021-11-26
  • 2021-10-27
  • 2021-05-12
相关资源
相似解决方案