Linux-ubuntu Server Basics

Source: Internet
Author: User
Tags install mongodb virtual environment install redis

Ubuntu Server: The deployment environment that is used to deploy the project's server system.

Xshell: The tool used to connect to Linux. Web projects are deployed to remote servers, so Xshell is required to connect to the remote server.

Pycharm: Development tools (Pro version is more user friendly for web development)

Python3: Programming language.

Installation method One: directly with someone else's packaged OVA

The great God has done the OAV file for me, which contains MySQL, Redis, MongoDB, python3.5.

I use VMware. After you install VMware, the file is automatically associated, and you can double-click the OAV file directly.

Two inputs required during installation: Bash install.sh

The first time you configure the network, the system restarts automatically. The second execution is the normal installation.

(Bash command: command to execute some script file)

Installation Method II: Install Yourself

As to which distribution to choose to do the server (need to fix the internet problem)

I chose Ubuntu Server for my own introduction. The system was later upgraded, but a lot of problems arose. And then kill this and reload the latest version.

(a). After the image has been downloaded, I choose to install it with VMware. VMware will be easy to install for us. is to set your favorite user name and password can be. Note: The installation interface of ubuntu18.04 LTS has changed a lot, and it has to be set up in one step.

(1). Tip 1: The system installed, first upgrade apt, or you many plugins are not loaded! Command: sudo apt update then sudo apt upgrade

(2). Hint 2: The new system, there must be many programs have not been installed, the execution of the command, if there is no such program, Ubuntu Server will have a corresponding hint. Directly prompted the installation of the command, just knock on it.

(3). View the version of the current system: sudo lsb_release-a

(b). Xshell Connecting virtual machines

(1). I installed the 2018 released python3.7.0

#install dependencies first. Avoid modulenotfounderror No module named "_ctypes" This errorsudo apt-Get Updatesudo apt-Get Upgradesudo apt-get dist-Upgradesudo Apt-get Install build-essential python-dev python-setuptools python-pip python-Smbussudo Apt-get Install Libncursesw5-dev Libgdbm-dev libc6-Devsudo Apt-get Install Zlib1g-dev Libsqlite3-dev tk-Devsudo Apt-get Install libssl-Dev Opensslsudo Apt-get Install libffi-Dev#Start Installation#implement ready Source PackagesTAR-XVF Python-3.7. 0.TGZCD Python-3.7. 0./configuremake sudo make altinstall
View Code

(2). From the domestic source, install the module

For example, install the virtual environment: sudo pip3 install-i https://pypi.douban.com/simple virtualenv

(iv). Install MySQL

Https://www.linuxidc.com/Linux/2017-05/143864.htm

Note: After MySQL is installed, if you cannot mysql-u Root-p is rejected, execute the following code:

sudo mysql-u rootuse mysql;mysql> Update user set plugin='mysql_native_password' where user='root'; flush privileges;
View Code

(v). Installing Redis

(1). sudo apt update first

(2). Then enter the command: sudo apt install redis-server for direct installation.

(3). Enter command: Redis-server, start the service.

(4). You can use "redis-server-v" to view the current version of Redis.

(vi). Installing MongoDB

(1). direct command: "sudo apt install MongoDB"

(2). Use "Mongod--version" to view the version

(vii). Precautions

(1). The Ubuntu system is not allowed to log on as the root user by default

Global vs. Virtual environments:

(i). Concept

First, the virtual environment is not a virtual machine, it is a development environment in the virtual machine.

Virtual machines are the equivalent of a pool, and a virtual environment is a bucket in a pool. A virtual environment a bucket, a bucket and a bucket are independent of each other, unrelated.

The PYTHON3 environment, which is configured in the global context, is unrelated to the virtual environment.

(ii). Use

Different projects may use an interpreter that is not used. For example, watermelon peel, it only supports python2.7.

Is it going to change the global environment because of a project? Not good, the global environment also collapsed.

Then build a virtual environment, and in Pycharm, connect the interpreter in this virtual environment.

While other projects, connect the interpreter in other virtual environments. Each virtual environment is unrelated to each other, so no brawl occurs.

One, two commonly used virtual machines

What is a virtual machine? is a small computer in the computer system.

Vmware:

Professional virtual machine software, very useful! (Eating memory is bad)

VMWARE11 no longer supports 32-bit systems, VMWARE10 is the last version to support 32-bit systems.

Special Note: Running "UBUNTU1604_SERVER_32BIT.OAV" in a 32-bit system is problematic, you need to open "ubuntu1604_server_32bit.vmx" with Notepad in the physical machine's file,

The original virtualhw.version= "11" In this line of "11", changed to "10". Once saved, it's no problem to run again. Results such as:

Ii. Two networking modes

1. Bridging: for WiFi. As with the host level, it is equivalent to plugging in a network cable.

2.nat mode: Equivalent to the physical machine as a router, outside the Internet.

Supplement: VirtualBox using NAT mode, the Xshell connection requires port forwarding. VMware requires very little port forwarding.

Port do not write casually, avoid writing: 80 8080 443 3389 8443, will occupy! Especially 80 8080!

Xshell uses SSH services to connect to Linux.

Third, the basic content of Linux

Linux is stable, and many users do not interfere with each other. Each user is a folder in the home directory.

Linux has no drive letter, only one root directory, and all files are placed under the root directory.

Linux is all files, even directories, is a file.

Linux partition Case! There must be a space between the command and the argument!

Iv. Linux Basic commands

(i). PWD Displays the current full path

(b). CD Interactive Directory

The default entry home (home) directory. Switch root: CD/switch home directory: cd ~ Switch User: Su root exits the current user, goes back to the previous user: Exit as long as it is not the root directory, is relative path: CD directory Name/previous directory: CD-

Add: Change root password: sudo passwd xxxxx. The root user password for this OAV is random. Root User id: #, normal User id: $.

(c). LS View

Ls-a All files (there is a dot in front of the hidden file ".") )

Ls-l More information

Ls-h more humane

(often: Ls-lh out of the results of the visibility of particularly good)

Ls-s Case Sensitive

(d). Man Help

Man + command. But CD doesn't help, it's an exception. Page Flip: b Up, F down, Q exit

(v). Tree view, see directory structure

If there is an error, you will need to install it: sudo apt-get install tree sudo (root user does not have to mention the right)

(vi). mkdir Creating a Directory

Mkdir-p classification creation; mkdir-v see the process;

Example 1:MKDIR-VP aa/bb/cc first create AA, and then build BB under AA, and then build cc under BB; Similarly, delete can also be-VP

Example 2:mkdir QW We er is a three-sibling directory.

(vii). Touch new File (editable)

Example: Touch demo.py Note: The suffix in Linux is for people to see. Linux does not differentiate between what files are considered to be files.

(eight). RmDir Delete Empty directory (if there is a file in the directory, it will not be deleted)

Example 1:rmdir a/b/c deletes the C directory, because the path is exactly "C"

(ix). RM Delete File

Rm-r Grading Delete

Example: Rm-r a deletes the entire a directory

Rm-f Force Delete

Example: RM-RF * Can say: don't use! It's all erased! The cost of restoring Linux is quite huge.

(10). Cat view, Cat cat, take a peek at it like a cat.

(11). more/less

More after the automatic exit, less must press Q exit.

(12). Soft and Hard links

Soft and hard link: the content of the source file has changed, and the contents of the linked file have been modified at the same time.

The difference is that when the source file is deleted, the soft link is discarded. Hard links can still be used.

A hard link is equivalent to a backup.

Linux-ubuntu Server Basics

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.