Build an Ubuntu development environment

Quote: Recently, I have been using my Own Mac Book for development work in the company. Somehow, the Windows host of the company cannot run the EggJS framework Web project (simple demo project can run, but the project under development cannot run). So I have no choice but to install the host directly into Ubuntu system. It’s almost like Windows 88. Let me share the setup process:

Installing Ubuntu

  1. Download the system image and make a USB disk to boot

Ubuntu uses the latest stable version 20.04, and the usb boot system is MacOS Big Sur 11.1. Please go to the official website to download the usb boot system.

    1. Convert the ubuntu-20.04.1-desktop-amd64.iso image file to Ubuntu. DMG
Hdiutil convert-fomat udrw-o ubuntu. DMG ubuntu-20.04.1-desktop-amd64.isoCopy the code
    1. When installing the system, it is recommended to choose the English operating system, so as to avoid the Chinese folder and avoid the embarrassment that the corresponding folder cannot be entered because Chinese cannot be entered in Terminal.
    1. After the system is installed, I need to set static IP address, configure gateway and other information because I am in the company’s network environment, otherwise I cannot connect to the Internet. Those without this restriction can skip this step.

Ps: VI is very, very unfriendly to Ubuntu. Take a closer look at the basic operation of VI. Here are some quick tips:

  • Cursor movement in the default command mode: h j K L
  • Start to append text after the cursor and enter edit mode: A
  • Start inserting text before cursor and enter edit mode: I
  • To delete content: Press ESC to exit the editing mode, then move the cursor to the position of the letter you want to delete, then press del to delete
  cd /etc/netplan
  ll
  vi  01-network-manager-all.yaml
Copy the code

The contents are as follows, please ask the operation and maintenance guy for the IP address:

    1. After the system is installed, modify apt source and apply:
  sudo vi /etc/apt/sources.list
Copy the code

willcn.archive.ubuntu.com/ubuntu/Instead of the domestic available APT source, I usemirrors.163.com/ubuntu/ After saving the changes and exiting, remember to apply for the configuration to take effect immediately:

  sudo netplan apply
Copy the code

Ps: The figure above shows the optimized display effect after vim installation. The command for vim installation is as follows:

  sudo apt-get install vim-gtk
Copy the code
  1. Set the system language and Chinese input method

Change the system language to Chinese. When applied globally, the system will pop up an operation prompt whether to change the names such as Documents and Dowloads to Chinese. Select no. When the folder and path name are In Chinese, it is very inconvenient to enter the Chinese path in Terminal, so it is better to keep English.

Set language is not said, we Baidu bar, I will post a picture meaning, in addition, my Chinese input method installed is sogou, itsInstall the helpIt’s clear enough to test.

  1. Install communication software

Configuring the Development Environment

    1. git
sudo apt install git-all
Copy the code
    1. Visual Studio Code

Ubuntu Software has it, just install it

    1. chrome
cd /Downloads
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
sudo dpkg -i google-chrome*; sudo apt-get -f install 
Copy the code
    1. nodejs

Reprint: Install NodeJS on Ubuntu

The installation

sudo apt-get install nodejs
sudo apt-get install npm
Copy the code

Upgrade and switch node versions

Sudo NPM install NPM -g NPM install -g n n latest# (upgrade node. Js to the latest version) NPM config set registry at http://registry.npm.taobao.org/
n stable # (Upgrade Node.js to the latest stable version)
Copy the code

Replace the NPM image

Get the original mirror address
npm get registry 
# Set to Taobao
npm config set registry http://registry.npm.taobao.org/
I'm going to change that
npm config set registry https://registry.npmjs.org/
Copy the code