Alibaba Cloud Server Ubuntu Configuration Tutorial

Alibaba Cloud Server Ubuntu Configuration Tutorial

Since Alibaba Cloud's import of custom Ubuntu images requires activation of OSS snapshots, which is charged (it doesn't seem expensive, but it's also very troublesome), and the image you have configured needs to be converted to a different format if you want to import it, and there may be cases where it cannot be used, so it's a bit troublesome to directly configure the required content in Alibaba Cloud's original Ubuntu.

First of all, the default version of Ubuntu on Alibaba Cloud Server is 14.04. You need to log in to Alibaba, enter the console-ESC instance-Management-Pause server-Update system disk (more options in the configuration information block)-Public image-here I choose 64-bit Ubuntu 16.04 (currently the highest version of Alibaba Cloud public image is Ubuntu 16.04).

0. Install sudo

apt-get install sudo

1. Set up users

Create User

useradd -m -s /bin/bash 用戶名

Set password

sudo passwd 用戶名

# After completion, there will be an additional directory named after the user in the home directory

Set root permissions for ordinary users

Get write permission to sudoers

chmod u+w /etc/sudoers

(Some basic operations of VIM: i switches input mode, esc switches command mode, and in command mode, enter :wq to save and exit)

Enter VIM

vim /etc/sudoers

Add this code below the root line, save and exit

UsernameALL=(ALL) ALL

Revoke sudoers write permissions

chmod uw /etc/sudoers

2. Download python3.x (download it if you need a higher version)

Ubuntu 16.04 comes with python 2.7 and python 3.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. Here I use Xshell5

Create a directory to store the virtual environment

Install the directory where the virtual environment is stored

mkdir $HOME/.virtualenvs

(Here, in the /home/username directory, ls -a queries hidden files)

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, run source ~/.bashrc

4. Create a virtual environment with the default python3.x

Query the Python path

which python3.5

Return result: /usr/bin/python3.5

Create a new virtual environment

mkvirtualenv -p python path virtual environment name

Example: mkvirtualenv -p /usr/bin/python3.5 dj

Automatically activate the virtual environment every time you start the virtual machine

Every time the virtual machine is turned on, .bashrc will be run, so just edit .bashrc

vim ~/.bashrc

In the last line enter

workon virtual environment name

Example: workon dj

--------------------------------------------------------------------------------

Note: The default Python in the virtual environment is 3.5.2, while the default Python outside the virtual environment is 2.7.12

Query Python version

python -V

Exit the virtual environment

deactivate

Enter the virtual environment

workon virtual environment name

View the existing virtual environment

workon

--------------------------------------------------------------------------------

Some content of Django configuration will be updated in the near future

Summarize

The above is the Alibaba Cloud Server Ubuntu configuration tutorial introduced by the editor. I hope it will be helpful to everyone. If you have any questions, please leave me a message and the editor will reply to you in time. I would also like to thank everyone for their support of the 123WORDPRESS.COM website!

You may also be interested in:
  • How to build pptpd service in Alibaba Cloud Ubuntu 16.04
  • Detailed explanation of how to connect node to mongodb database [Alibaba Cloud Server Environment Ubuntu]
  • Alibaba Cloud Deployment of Ubuntu 1.4 Flask + WSGI + Nginx Detailed Explanation
  • How to change the Alibaba Cloud source in Ubuntu 14.04
  • Graphic tutorial on configuring and accessing Alibaba Cloud Server (Ubuntu system) on Mac
  • Analyze the configuration of Apache+PHP+PHPmyadmin+MYsql in Alibaba Cloud Ubuntu 12.04 environment
  • Alibaba Cloud Ubuntu 16.04 builds IPSec service

<<:  Vue implements sample code for dragging files from desktop to web page (can display pictures/audio/video)

>>:  How to export CSV file with header in mysql

Recommend

Detailed installation process of mysql5.7.21 under win10

This article shares the installation of MySQL 5.7...

Detailed steps for adding hosts you need to monitor in zabbix

Add monitoring host Host 192.168.179.104 is added...

Vue implements the right slide-out layer animation

This article example shares the specific code of ...

Detailed steps for manually configuring the IP address in Linux

Table of contents 1. Enter the network card confi...

Detailed explanation of JavaScript timers

Table of contents Brief Introduction setInterval ...

How to implement digital paging effect code and steps in CSS

A considerable number of websites use digital pagi...

Running PostgreSQL in Docker and recommending several connection tools

1 Introduction PostgreSQL is a free software obje...

How to solve the problem that mysql cannot be closed

Solution to mysql not closing: Right-click on the...

JavaScript to achieve click image flip effect

I was recently working on a project about face co...

An article to understand the use of proxies in JavaScript

Table of contents What is an agent Basic knowledg...

How to test network speed with JavaScript

Table of contents Preface Summary of the principl...

Optimization of MySQL thread_stack connection thread

MySQL can be connected not only through the netwo...

WeChat applet implements simple calculator function

This article shares the specific code for the WeC...

Oracle deployment tutorial in Linux environment

1. Environment and related software Virtual Machi...

How to clean up the disk space occupied by Docker

Docker takes up a lot of space. Whenever we run c...