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

CSS3 uses animation attributes to achieve cool effects (recommended)

animation-name animation name, can have multiple ...

Install zip and unzip command functions under Linux and CentOS (server)

Install zip decompression function under Linux Th...

43 Web Design Mistakes Web Designers Should Watch Out For

This is an article about website usability. The a...

Linux system prohibits remote login command of root account

ps: Here is how to disable remote login of root a...

Example steps for using AntV X6 with Vue.js

Table of contents 0x0 Introduction 0x1 Installati...

Summary of horizontal scrolling website design

Horizontal scrolling isn’t appropriate in all situ...

How to regularly clean up docker private server images

Using CI to build docker images for release has g...

Web Design Tutorial (6): Keep your passion for design

<br />Previous article: Web Design Tutorial ...

How to use Tencent slider verification code in Vue3+Vue-cli4 project

Introduction: Compared with traditional image ver...

JS asynchronous code unit testing magic Promise

Table of contents Preface Promise chaining MDN Er...

30 Tips for Writing HTML Code

1. Always close HTML tags In the source code of p...

The difference between JS pre-parsing and variable promotion in web interview

Table of contents What is pre-analysis? The diffe...

Introduction to Linux common hard disk management commands

Table of contents 1. df command 2. du command 3. ...

A brief discussion on the Linux kernel's support for floating-point operations

Currently, most CPUs support floating-point units...