Set up an integrated development environment on a cloud server

This article was last updated on: July 24, 2024 am

Python optimizes the configuration

Install the relevant software:

1
2
3
4
5
6
7
sudo yum install -y --setopt=tsflags=nodocs gcc make patch  # 安装编译软件
sudo yum group install -y development # 安装开发包组
sudo yum install -y --setopt=tsflags=nodocs gdbm-devel openssl-libs openssl-devel openssl-devel ncurses-devel libsqlite3x-devel sqlite-devel readline-devel zlib-devel bzip2-devel python2-bz2file db4-devel libpcap-devel xz-devel libffi-devel sqlite3 sqlite python-ujson # 安装依赖

sudo yum install -y mariadb mariadb-server redis memcached # 安装mariadb
sudo systemctl enable mariadb.service redis.service # mariadb redis 开机启动
sudo systemctl start mariadb.service redis.service # 启动mariadb服务

Install Python 3.6

1
sudo yum install -y python36

Install pip:

1
sudo yum -y install python-pip python34-pip python36-pip

pip conf:

in the file~/.pip/pip.confAdd or modify:

[global]
index-url = http://mirrors.tencentyun.com/pypi/simple
trusted-host = mirrors.tencentyun.com

Reference Articles:

Tencent Cloud Software Source accelerates package download and update

Install pipenv: (mainly using Python 3.6)

1
pip3.6 install pipenv --user

edit~/.zshrc, add the following:

1
export PATH=/home/casey/.local/bin:$PATH

Subsequent usepipenvTo manage files, there are the following points:

  1. When installing, according to the existing python of the OS, specify according to the existing python, such as: pipenv install --python /usr/bin/python36
  2. Can be modifiedPipfileThe following configurations speed up dependency downloads:
[[source]]
url = "http://mirrors.tencentyun.com/pypi/simple --trusted-host mirrors.tencentyun.com"
verify_ssl = false

Compile and install Python 3.7

You need to install yum firstlibffi-devel

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# 下载源码包并解压
wget https://www.python.org/ftp/python/3.7.2/Python-3.7.2.tgz
tar -xvzf Python-3.7.2.tgz
cd Python-3.7.2
# configure
sudo mkdir -p /usr/lib64/python3.7
sudo ./configure --prefix=/usr/lib64/python3.7
# install
sudo make && sudo make install
# 创建软连接
sudo rm -f /usr/bin/python3
sudo ln -s /usr/lib64/python3.7/bin/python3 /usr/bin/python3
# 加入PATH
vi ~/.zshrc
# .zshrc修改为以下内容
export PATH=/usr/lib64/python3.7/bin:/home/casey/.local/bin:$PATH
# 使得配置生效
source ~/.zshrc
# 验证
python3 -V
# 输出: Python 3.7.2
pip3 -V
# 输出: pip 18.1 from /usr/lib64/python3.7/lib/python3.7/site-packages/pip (python 3.7)

Docker configuration

Installation

1
sudo yum install -y --setopt=tsflags=nodocs docker docker-compose docker-distribution docker-logrotate docker-lvm-plugin 

Modify the repository source

Available for CentOS 7 releases.

Modify the Docker configuration file sudo vi /etc/sysconfig/dockerAs follows:

1
OPTIONS='--registry-mirror=https://mirror.ccs.tencentyun.com'

Reference Articles:

Use the DockerHub accelerator

Power on

1
sudo systemctl enable docker
  1. console, enterContainer ServiceImage repositoryMy mirror , enter the personal password of the image repository. (The account number is AppID)

  2. (Optional): InAccess managementUser groupsCurrent user groupAssociation policy : QcloudCCRFullAccess (Full read and write permissions of the image repository)

  3. Log on to the ECS with the following command:

    1
    sudo docker login --username=appid ccr.ccs.tencentyun.com
  4. Download the image:

    1
    sudo docker pull ccr.ccs.tencentyun.com/[namespace]/[ImageName]:[镜像版本号]

Set up an integrated development environment on a cloud server
https://e-whisper.com/posts/41740/
Author
east4ming
Posted on
March 27, 2019
Licensed under