Initial settings after installing Ubuntu 16 in the development environment

Initial settings after installing Ubuntu 16 in the development environment

The office needs Ubuntu system as the Linux development environment. Currently, Ubuntu 16.04 is the most commonly used. So here we also use Ubuntu 16.4 as the office development environment for some initialization.

Open the command line

Ubuntu 16.04 version right click - open terminal

Some Ubuntu 14.04 does not have a built-in right-click function to open the terminal, which is very inconvenient to use. I suddenly remembered it today and searched it online. The method is as follows:

$ sudo apt-get install nautilus-open-terminal

Log out of the system and log in again.

Set the root user password

Ubuntu does not start with the default root password. Set a root password. sudo passwd root Enter the password of the user you installed with and set the root password.

Update software sources

sudo apt-get upgrade

Update Software

sudo apt-get update

Install Google Chrome

sudo wget http://www.linuxidc.com/files/repo/google-chrome.list -P /etc/apt/sources.list.d/
wget -q -O - https://dl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
sudo apt-get update
sudo apt-get install google-chrome-stable
/usr/bin/google-chrome-stable

Input method: Sogou

Download Sogou
https://pinyin.sogou.com/linux/?r=pinyin

Double-click the downloaded deb file to install the software in the software center.

im-config

Change the above ibus to fcitx and restart the PC.

fcitx-config-gtk3

Just choose Sogou.
In order to use shift to switch between Chinese and English normally, you need to keep Sogou Input Method as the first one and Keyboard-English (US) as the second one (keeping the second one as English is so that Sogou can switch between Chinese and English normally in shift). You can delete other input methods.
If you want to use shift to switch between Chinese and English, you need to restart.

Install necessary software

vim is often used to edit files
curl is used to download files

sudo apt-get install vim curl

The login user that can be selected at login

Use su root to test whether you can enter the root user. If # appears, it means that the root user's password has been successfully set.

Open the file as root user

sudo vim /usr/share/lightdm/lightdm.conf.d/50-ubuntu.conf

Add the following information in the open file to set the user login option when logging in

user-session=ubuntu
greeter-show-manual-login=true
all-guest=false

Use the vi /root/.profile command to modify the file, find mesg n, and modify it to: tty -s && mesg n || true

Install ssh login method

Install ssh login method to be remotely accessed by other computers

sudo apt-get install openssh-server

Creating a public key and a private key allows others to access you smoothly, and you also need to provide your own public key when synchronizing the gitlab repository.

ssh-keygen

Press Enter all the way, the command will generate the key, and the generated private key and public key files will be in the .ssh/ directory of the root directory.

View the public key

cat .ssh/id_rsa.pub

You can see that your public key is a string similar to the following

ssh-rsa AAxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx5R

The public key will be used later when linking gitlab

View the local IP address

ifconfig

Over the Wall

Download address: https://github.com/getlantern/lantern
Download lantern-installer-64-bit.deb
After installation, search for lantern, open the software, and the firewall-circumvention tool will run automatically. You can access foreign websites in your browser. Experimental website: https://www.google.com/

Install Ubuntu terminal multi-window split screen Terminator

Please enable the firewall-breaking tool during installation.

sudo apt-get install terminator

shortcut key

  • Ctrl+Shift+E Split window vertically
  • Ctrl+Shift+O Split window horizontally
  • F11 Full Screen
  • Ctrl+Shift+C Copy
  • Ctrl+Shift+V Paste
  • Ctrl+Shift+N or Ctrl+Tab Switch between split windows
  • Ctrl+Shift+X Enlarge a split window to full screen
  • Ctrl+Shift+Z Return to the multi-pane interface from a window that has been enlarged to full screen

Note: Since terminator is written in Python, different Python versions may cause errors when starting. After installation, directly enter terminator in the command line, it will start normally. If it cannot start normally, an error will be reported. For example, my computer is Python 3.6, and an error will be reported when starting. I need to copy the file /usr/bin/terminator

  • except (KeyError,ValueError), ex:
  • Modified to
  • except Exception as e:

Appearance and shortcut keys, refer to the URL: //www.jb51.net/article/148934.htm

If terminator doesn’t work, use tmux

sudo apt-get install tmux

ctrl+b is the prefix command of tmux

ctrl+b % Split a new window horizontally

ctrl+b " Split a new window vertically

ctrl+bx Close the window where the cursor is currently located

ctrl+b ! Close all windows

ctrl+b arrow keys switch windows

ctrl+bt displays a clock

ctrl+b pageup/pagedown Pageup/pagedown in normal mode, press ecs key to exit page turning

ctrl+b [ Enter copy mode, which is the same as copying and pasting in normal mode. Press ecs to exit

If you want to use the mouse to control

Check the current version of tmux:

tmux -V (uppercase V)

Edit the tmux configuration file:

sudo nano ~/.tmux.conf

tmux2.1 and later versions:

set-option -g mouse on

tmux versions prior to 2.1:

setw -g mouse-resize-pane on

setw -g mouse-select-pane on

setw -g mouse-select-window on

setw -g mode-mouse on

Add these lines of configuration to ~/.tmux.conf, then press Cb in tmux: execute source ~/.tmux.conf to take effect

Basic configuration of python and pip

Ubuntu 16.04 comes with python2 and python3, but the default link is python2

Change the Python link version

Change the /etc/bin/python link to python3.5 (the original link points to python2.7)

sudo rm /usr/bin/python # Delete the original link sudo ln -s /usr/bin/python3.5 /usr/bin/python # Create a new link

Enter python in the command line to view the python version

If you don't know where to install it

which pip # Check where is pip/pip3 Unable to find pip location

Install pip and other required plugins

sudo apt-get install python-pip python-dev build-essential 
sudo pip install --upgrade pip 
sudo pip install --upgrade virtualenv 
sudo pip install --upgrade pip # After upgrading pip, pip can no longer be used. You can repair it by the following method: gedit /usr/bin/pip 
Modify the corresponding part and install pip2's version manager #!/usr/bin/python2
from pip import __main__
if __name__ == '__main__':
 sys.exit(__main__._main())

Switch the image source of pip, otherwise pip downloads too slowly

If you want to install pip3 manager
gedit /usr/bin/pip

Modify the corresponding part and install pip2's version manager

gedit /usr/bin/pip3 
#!/usr/bin/python3.6
from pip import __main__
if __name__ == '__main__':
 sys.exit(__main__._main())

Create or open the /etc/pip.conf file with administrator privileges and set the following content to replace the Alibaba Cloud image:

[global]
trusted-host = mirrors.aliyun.com
index-url = http://mirrors.aliyun.com/pypi/simple

Or Douban Cloud Mirror

[global]
trusted-host=pypi.douban.com
index-url = http://pypi.douban.com/simple/

Install python3.6, python3.7

Install Dependencies

# Install dependencies zlib, zlib-devel
# In Ubuntu, zlib is called zlib1g, and the corresponding zlib-devel is called zlib1g-dev
$ sudo apt-get install zlib1g
$ sudo apt-get install zlib1g-dev

First, go to the Python official website to download the Python 3 source code package, URL: https://www.python.org/

Open the terminal and use the command cd to enter the folder where the file is located to decompress the file

tar xfz Python-3.6.1.tgz

The xfz command is used here, and the -xvzf command is not recommended because the released folder requires root permissions to be changed or deleted.

Go into the released folder

cd Python-3.6.1/

Add Configuration

./configure --prefix=/usr/bin/python3.6

What needs to be configured is the folder where Python is installed. After the configuration is completed, the terminal will display the following paragraph. You can choose to ignore it without affecting subsequent operations.
If you want a release build with all optimizations active (LTO, PGO, etc),
please run ./configure –enable-optimizations

Compile source code

sudo make

Perform the installation

sudo make install

The installation process lasts for several minutes. After successful installation, the installed Python will be in the /usr/python3.6 folder on your computer.

Modify the default Python version

Ubuntu 16.04 integrates Python 2.7 and 3.5. The original python in the system is in /usr/bin/python. Through ls -l, you can see that python is a soft link to python 2.6 in this directory.
We need to delete this default link first, and then create a new soft link for python3.6.
First, make sure the terminal pointer has returned to the root directory, then perform the following operations

You need to delete the original Python link file:

rm /usr/bin/python

Note that if the terminal prompts: rm: cannot delete '/usr/bin/python': insufficient permissions, then you need to open the root permission to delete the link.

Create a link to Python 3.6:

ln -s /usr/bin/python3.6/bin/python3.6 /usr/bin/python

Query Python version

python --version

If it shows python3.6.1, it means the installation is successful!

Install and configure git

The code of R&D personnel is generally stored on gitlab because private repositories can be created.

To register for gitlab, you need to open a VPN, but you don't need a VPN to log in to gitlab.

After logging in to the gitlab account, open the git account settings and add the local public key in the SSH key. The method of viewing the local public key is introduced in the previous ssh section.

Install Git

sudo apt-get install git

Clone the branch to the local repository, here it is cloned to the current directory.

git clone -b branch name git@website/warehouse name

For example: git clone -b offline-v2.5.0 git@gitlab.com:intellif/kubespray.git

Clone the remote repository to local

git clone git@URL/warehouse name

Regarding the git@website/warehouse name of the above two commands, you can see it on the homepage of the warehouse.

Installing the Virtual Machine

When installing a virtual machine, do not use the online installation method, which may not be successful. It is best to directly download the latest virtual machine deb file from the official website and then double-click to install it. https://www.virtualbox.org/wiki/Downloads

screenshot

Install

sudo apt-get install gnome-screenshot

In the search, directly search for screenshots, and you can search for gnome-screenshot

Install the system cleaning tool BleachBit

sudo apt-get install bleachbit

Install the compression software RAR

sudo apt-get install rar

Install a Mac-like interface

Install docky and execute

sudo apt install docky

Close unresponsive windows

When some windows freeze during operation and cannot be closed using the close button, you can enter xkill in the command line and then click the frozen window with the mouse.

Software related operations View installation software

dpkg -l

To perform the uninstall:

sudo apt-get remove <package> # Delete the installed software package (keep the configuration file), do not delete the dependent software packages, and keep the configuration file.
sudo apt-get --purge remove <package> # Delete software and its configuration files

To uninstall the software:
To delete software in Ubuntu, you need to know the exact package name, so you need to learn to view the full package name of the software:

dpkg -l | grep mysql

The files you see may have been deleted. The first two characters indicate the status. rc means deleted but the configuration file is retained. ii means installed.

Find the software installation location:

which 軟件名

Solution to Dual-system Ubuntu cannot enter Windows disk

1. Press Ctrl+Alt+T to open the terminal and enter the command to check whether ntfs-3g has been installed:

locate ntfs-3g

Enter the installation command:

sudo apt-get install ntfs-3g

2. Repair the corresponding partition with mounting error, such as /dev/sda7 in the prompt, and enter the repair command:

sudo ntfsfix /dev/sda7

3. Generally, different partitions are repaired in this way. Sometimes the following problems may occur:
(My partition is the win10 system disk and was rejected)
Enter win10, turn off fast startup, yes, turn it off and it will be ok

Windows and Ubuntu shared folders in the same LAN

1. Windows 10 and Ubuntu are connected to the same LAN.
2. Create a new folder on win10, right-click properties-share-add all users to read and write. Confirm Share to generate a sharing link.

For example, my file name is windows_linux_share, and the generated shared link is //LAPTOP-NEFGGCT3/windows_linux_share

3. Install samba-client in Ubuntu system (sudo apt-get install smbclient);

4. Install cifs-utils in Ubuntu system (sudo apt-get install cifs-utils);

5. Create a new directory my_share in Ubuntu system (mkdir /mnt/my_share);

Change the username and password under win10. If you already know the win user password, you don’t need to change it. Press ctrl+alt+del to change the password. You can see your user name and set a new password. The old password of the new computer is empty by default.

6. Mount windows_linux_share on windows to /mnt/my_share on ubuntu (sudo mount -t cifs -o username=lenovo //192.168.100.105/windows_linux_share /mnt/my_share, where lenovo is the windows user name and 192.168.100.105 is the ip address of the windows host. The following prompt appears when the above command is run: Password for Administrator@192.168.100.105/windows_linux_share:, enter the password of the lenovo user on the windows host);

7. In addition, you can access the contents of the windows_linux_share folder under Windows in the /mnt/my_share directory

Place the launcher at the bottom

Install unity-tweak-tool

$ sudo apt-get install unity-tweak-tool
$unity-tweak-tool

Select "Launcher" and enter.

In the appearance, the position is on the left by default, select "Bottom".

To change the size of the panel, you can set the "icon size" and the panel will adapt to the icons.

Adjust the order of launcher icons

If you want to adjust the position of an icon on the launcher, you can click to select the icon, then drag the icon outward (note that you should not pull it directly in the direction of the launcher, but vertically in the direction of the launcher). When it is pulled out of the original position, you can drag it in the direction of the launcher to change the position of the icon.

The title bar displays the network speed, CPU memory in real time

sudo add-apt-repository ppa:fossfreedom/indicator-sysmonitor 
sudo apt-get update 
sudo apt-get install indicator-sysmonitor

Execute in the terminal: indicator-sysmonitor &, then press Ctrl+C to run indicator-sysmonitor in the background

For convenience, you also need to add the program to start at boot! Right-click the icon on the title bar to pop up the menu and select Preferences.

Check Run on startup: and it will start at startup. Switch to Advanced options,

The format of the information to be displayed can be set.

You can try setting other formats and test them again until you are satisfied with the results and click Save.

Okay, that’s all!

Set up the Alibaba Cloud image pool for the Ubuntu software list

Back up the original source

sudo cp /etc/apt/sources.list /etc/apt/sources.list.bakcup

Edit the original file

sudo vim /etc/apt/sources.list

deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse

renew

sudo apt update

In this way, a complete set of Ubuntu 16 initialization settings is basically completed.

Summarize

The above is the full content of this article. I hope that the content of this article will have certain reference learning value for your study or work. Thank you for your support of 123WORDPRESS.COM. If you want to learn more about this, please check out the following links

You may also be interested in:
  • Detailed tutorial on Maven pom.xml file in Java
  • How to install the Spire series of Java products through the Maven repository
  • Docker builds Nginx+PHP+MySQL environment and deploys WordPress practice
  • Detailed explanation of using Docker to deploy Node.js development environment under Windows
  • Dockerfile deployment java web environment detailed explanation
  • Initialize Ubuntu 16.04 in three minutes, deploy Java, Maven, and Docker environments

<<:  A brief discussion on the manifestation and value selection method of innodb_autoinc_lock_mode

>>:  Vue imitates Ctrip's carousel effect (sliding carousel, highly adaptive below)

Recommend

A guide to writing flexible, stable, high-quality HTML and CSS code standards

The Golden Rule Always follow the same set of cod...

How to deal with too many Docker logs causing the disk to fill up

I have a server with multiple docker containers d...

js implements random roll call

This article shares the specific code of js to im...

Vue-Element-Admin integrates its own interface to realize login jump

1. First look at the request configuration file, ...

Detailed explanation of the usage of compose function and pipe function in JS

Table of contents compose function Array.prototyp...

How to align text boxes in multiple forms in HTML

The form code is as shown in the figure. The styl...

MySQL query example explanation through instantiated object parameters

This article will introduce how to query data in ...

React implements the sample code of Radio component

This article aims to use the clearest structure t...

Detailed explanation of CSS style sheets and format layout

Style Sheets CSS (Cascading Style Sheets) is used...

How to install MySQL 5.7 on Ubuntu and configure the data storage path

1. Install MySQL This article is installed via AP...

JavaScript microtasks and macrotasks explained

Preface: js is a single-threaded language, so it ...

How to install git on linux

1. Introduction Git is a free, open source distri...

Centos7 installation of FFmpeg audio/video tool simple document

ffmpeg is a very powerful audio and video process...