ubuntu服务器配置

本人用的是阿里云
1.用xshell连接服务器终端
2.用filezilla连接服务器用来传文件
3.更换ubuntu源为阿里源

拷贝sources.list:
sudo cp /etc/apt/sources.list /etc/apt/sources1.list
删除配置文件
sudo rm /etc/apt/sources.list

打开配置文件:
sudo vi /etc/apt/sources.list

按i进入插入模式,然后粘贴aliyun的源
deb cdrom:[Ubuntu 16.04 LTS _Xenial Xerus_ - Release amd64 (20160420.1)]/ xenial main restricted deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial main restricted deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates main restricted deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial universe deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates universe deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial multiverse deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates multiverse deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security main restricted deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security universe deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security multiverse

然后按esc退出插入模式
按住shift+zz退出+保存
4.更新源
更新源:
sudo apt-get update

5.安装Python3.6:
sudo apt-get install -y software-properties-common sudo add-apt-repository ppa:jonathonf/python-3.6 sudo apt-get update sudo apt-get install -y python3.6

这个时候使用pip -V查询,会发现pip还是python3.5的pip,如何指向python3.6呢,首先是删除pip
apt-get remove python3-pip apt-get -y autoremove自动删除多余文件

6.装好后将3.6设置为默认环境 删除原始pip,重装pip
然后再安装pip
apt-get install -y python3-pip

发现pip还是指向 python3.5的,这个时候再用python3.6指定升级一下pip:python3.6 -m pip install –upgrade pip`
就指向python3.6了。

设置Python3.6的优先级:
sudo update-alternatives --install /usr/bin/python python /usr/bin/python2 100 sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.6 200

7.安装必要的Python包

8.安装必要的ubuntu软件

9.通过Python manage.py runserver 0.0.0.0:8000运行项目

启动 Redis
service redis start(stop)(restart)
ubuntu 安装mysql
sudo apt-get install -y mysql-server

终端连接mysql
mysql -uroot -p123456

创建数据库
create database pythondb;
退出数据库:
exit

开通的博客 http://www.jimietianxingzhe.com/

原文链接:https://blog.csdn.net/lb332747473/article/details/103709015

© 版权声明
THE END
喜欢就支持一下吧
点赞0 分享