在新服务器上配置nginx+python+supervisor

从一台新的ubuntu开始配置

1.添加新用户

使用命令

#adduser bobo

Adding user 'second' ...
Adding new group 'second' (1001) ...
Adding new user 'second' (1001) with group 'second' ...
Creating home directory '/home/second' ...
Copying files from '/etc/skel' ...
Enter new UNIX password: 
Retype new UNIX password: 
passwd: password updated successfully
Changing the user information for second
Enter the new value, or press ENTER for the default
    Full Name []: 
    Room Number []: 
    Work Phone []: 
    Home Phone []: 
    Other []: 
Is the information correct? [Y/n] y

在/etc/sudoers可以看到有关sudo的配置,将bobo加入sudo组就可以执行sudo

#usermod -g sudo bobo

2.添加阿里的源

备份/etc/apt/sources.list

#cd /etc/apt
#mv sources.list sources.list.bak

新建一个sources.list,将以下内容写入新建的文件中

deb http://mirrors.aliyun.com/ubuntu/ trusty main multiverse restricted universe
deb http://mirrors.aliyun.com/ubuntu/ trusty-backports main multiverse restricted universe
deb http://mirrors.aliyun.com/ubuntu/ trusty-proposed main multiverse restricted universe
deb http://mirrors.aliyun.com/ubuntu/ trusty-security main multiverse restricted universe
deb http://mirrors.aliyun.com/ubuntu/ trusty-updates main multiverse restricted universe
deb-src http://mirrors.aliyun.com/ubuntu/ trusty main multiverse restricted universe
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-backports main multiverse restricted universe
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-proposed main multiverse restricted universe
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-security main multiverse restricted universe
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-updates main multiverse restricted universe

之后执行#sudo apt update即可成功更换软件源

3.安装oh my zsh

首先切换到新建的用户bobo上登录。之后$sudo apt install zsh git安装zsh和git,完成之后使用以下命令安装ohmyzsh

sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

之后修改/etc/passwd对应账户之后的内容就可以将默认shell更改为zsh

4.安装python3.6, virtualenv,建立独立环境

安装zlib依赖

apt-get install zlib1g-dev

安装python36

wget https://www.python.org/ftp/python/3.6.0/Python-3.6.0.tar.xz
xz -d Python-3.6.0.tar.xz
tar -xvf  Python-3.6.0.tar
cd Python-3.6.0
./configure
make
sudo make install

第一次编译安装之后,有可能会发现输入python3.6 之后,方向键失效。
原因是 readline 库没有安装。

解决方式:

安装 readline 库
$sudo apt-get install libreadline-dev

安装之后,再将 python 重新编译安装一次

cd Python-3.6.0
./configure
make
sudo make install

指定环境的python版本(3.6没有zlib,很瓜皮,不好用)

virtualenv python36 --python=python3.5
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容