群晖Docker部署Ubuntu16.04搭建Django开发环境

项目场景:

在群晖中搭建基于Ubuntu的Django开发环境,涉及Docker,Ubuntu,Python,Django,MySQL

准备工作:

1.准备一台部署群晖DSM系统的NAS服务器
2.群晖中安装Docker套件
3.安装Ubuntu映像并启用容器

实施步骤:

1.安装setuptools

wget --no-check-certificate https://files.pythonhosted.org/packages/18/c0/36f3e535bf1fef10a8f0f6fbf5ea5f2a39e0a24b4b308058fc78af5237c5/setuptools-54.1.1.tar.gz tar -zxvf setuptools-54.1.1.tar.gz cd setuptools-54.1.1 python3 setup.py build python3 setup.py install 

2.安装pip

wget --no-check-certificate https://pypi.python.org/packages/source/p/pip/pip-20.2.2.tar.gz tar -zxvf pip-20.2.2.tar.gz cd pip-20.2.2 python3 setup.py build python3 setup.py install 

3.添加环境变量

export PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/syno/sbin:/usr/syno/bin:/usr/local/sbin:/usr/local/bin:/volume1/@appstore/py3k/usr/local/bin 

4.修改镜像

pip install /volume1/homes/pip-20.2.2.tar.gz #你的文件地址 pip config set global.index-url http://pypi.douban.com/simple #将源更换为国内镜像 
#创建虚拟环境 pyhon -m venv nas_env #启动虚拟环境 source nas_env/bin/activate 

5.安装ssh

apt-get update apt-get install ssh service ssh start ps -e |grep ssh 

6.安装mysql

apt-get install python3-pip apt-get install mysql-server 
apt-get install mysql-client apt-get install libmysqlclient-dev apt-get install python3-dev pip3 install mysqlclient 
usermod -d /var/lib/mysql/ mysql service mysql start 

7.安装python3.6

apt-get install -y software-properties-common add-apt-repository ppa:deadsnakes/ppa apt-get update apt-get install python3.6 update-alternatives --install /usr/bin/python python /usr/bin/python3.6 1 
curl https://bootstrap.pypa.io/ez_setup.py -o - | python3.6 && python3.6 -m easy_install pip 

8.安装启动python虚拟环境

apt-get install python3-venv python3 -m venv nas_env source nas_env/bin/activate 

原文链接:https://www.jianshu.com/p/df5c6f8d13ac

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