Aliyun Server ubuntu configuration tutorial
- 2020-12-09 01:15:00
- OfStack
Because ali cloud import custom ubuntu mirror need to open the OSS snapshot is charge (it is not expensive, but it's also very troublesome, and he has configured mirror want to import need transformation format, there is not used, so the trouble points directly in the original ubuntu ali cloud directly the content of the configuration needed.
First of all, the default version of Aliyun server ubuntu is version 14.04, so you need to log in to Aliyun, enter the console -ESC instance - management - pause server - update system disk (more options for configuration information block) - Public image - here I choose the 64-bit version of ubuntu16.04 (the highest version of Aliyun public image, ubuntu16.04).
0. Install sudo
apt-get install sudo
1. Set up users
Create a user
useradd -m -s /bin/bash 用户名
Set the password
sudo passwd 用户名
When complete, there will be an additional directory in the home directory named after the user
Set root permissions for ordinary users
Gets permission to write to sudoers
chmod u+w /etc/sudoers
(VIM 1 some basic operation i switch input mode, esc switch command mode, command mode input :wq save exit)
Enter the VIM
vim /etc/sudoers
Add this line 1 below root and save to exit
User name ALL=(ALL) ALL
Unwrite sudoers
chmod u-w /etc/sudoers
2. Download python3.x (to download the higher version)
ubuntu16.04 comes with python2.7 and python3.5.2. Here we will use 3.5.2
3. Install and configure the virtual environment
Download package
pip install virtualenv
pip install virtualenvwrapper
Then log in with the newly created user, in this case Xshell5
Create a directory to hold the virtual environment
Install the directory that holds the virtual environment
mkdir $HOME/.virtualenvs
(ls-ES94en will query the hidden file under /home/ username directory)
Open the.bashrc file and add 2 lines of code
sudo vim ~/.bashrc,输入密码
export WORKON_HOME=$HOME/.virtualenvs
source /usr/local/bin/virtualenvwrapper.sh
After saving and exiting, then run source ~/.bashrc
4. Create the default python3.ES109en
Query the path for python
which python3.5
Return results: / usr bin/python3. 5
New virtual environment
mkvirtualenv-p python path virtual environment name
Example: mkvirtualenv p/usr bin/python3. 5 dj
The virtual environment is automatically activated every time the virtual machine is turned on
The virtual machine runs.bashrc every time you boot it up, so just edit.bashrc
vim ~/.bashrc
Enter in the last line 1
workon virtual environment name
Example: workon dj
--------------------------------------------------------------------------------
Note: python in the virtual environment is 3.5.2 by default and 2.7.12 outside the virtual environment
Query the python version
python -V
Exit the virtual environment
deactivate
Enter the virtual environment
workon virtual environment name
View your existing virtual environment
workon
--------------------------------------------------------------------------------
Some of the django configuration will be updated in the near future
conclusion