Create an Ubuntu office environment


For engineers who often need to deal with various servers, Windows is obviously not a good choice. Unfortunately, I am short of money and have no way to experience MacOS. In comparison, Ubuntu is a good choice, and the hardware can basically be configured at will, including memory and solid-state drives. You can install whatever you want. Ubuntu20.04 has also been released. Based on the experience of using previous Ubuntu versions, I will now comprehensively write down how to create an office environment in the Ubuntu20.04 environment.

01-System installation

Download the Ubuntu LTS version image from the official website, burn it to a USB flash drive, and install it directly.
Note two points:
1) Try to install in English during the installation process.
2) If possible, install the system disk on an SSD and configure a SATA disk to store data. This will be explained later. The reason is that if the system disk fails to boot due to several unexpected power outages, at least important data such as codes and documents are less likely to be lost on the SATA disk.

02-IP configuration

After the system is installed, configure the IP first to ensure that the machine can access the Internet, because many subsequent software installations require an Internet connection.
IP configuration is relatively simple. Just click Settings-Network in the upper right corner and configure it according to the network rules.

03-System optimization one

03-01 root password configuration

At this time, you can use the sudo passwd command to configure the password of the root user.

03-02 System update

Because there will be software updates after LTS is released, after installing the system, first obtain the latest software and update it.
sudo apt-get update
sudo apt-get upgrade.
At this time, you will be prompted that the machine needs to be restarted. Ignore it first and restart after a while. .

03-03 Close the sudo operation of the current user and enter the password

During the above operations, you need to enter a password when performing sudo operations, which is very inconvenient.
The result of executing cat /etc/sudoers using the current ordinary user is:
cat: /etc/sudoers: Permission denied.
At this time, first switch to the root user and modify the contents of the /etc/sudoers file.
In %sudo ALL=(ALL:ALL ) Add a line below the ALL line with
the current user name ALL=NOPASSWD:ALL
and then save and exit.
At this time, you can use the current user to execute sudo cat /etc/sudoers to see the contents of the file, and there is no need to enter a password.
(When editing /etc/sudoers at this time, you may find that using vi to edit is not very convenient. Don’t worry, I will talk about the installation and configuration of vim later)

03-04 Restart test

After the system is updated, it is prompted that the restart operation has not been carried out. At this time, you can restart the machine to see if it starts normally and whether the set password takes effect.

04-Input method configuration

In an office environment, after all, the Chinese input method is still very necessary. Previously, Sogou input method was used in Ubuntu 16.04 or Ubuntu 18.04 environment, but now that there is an officially endorsed Baidu input method, it is better to use the officially endorsed one (Sogou input method can also be installed, please search for it yourself).
Baidu input method download address:
https://srf.baidu.com/site/guanwang_linux/index.html
Unzip the downloaded zip file, and then install it according to the instructions in "Baidu Linux Input Method Installation Method under Ubuntu.docx" alright.

Important: After the input method is installed, you need to restart

There will be no major problems in the installation process. The main trouble lies in the configuration. Usually, the Chinese input method uses shift to switch between Chinese and English. However, this method is particularly awkward when you need to enter various Linux commands most of the time, and when you need to input uppercase and lowercase letters, various underlines, and commonly used symbols such as $%. convenient.

After restarting, there will be Baidu input method settings first. Here we set "Keys" - "Chinese and English Switch" in the settings to "Do not use shortcut keys", that is, in the Chinese input scenario, there is no need to enter English characters. .

Click the icon in the upper right corner and select ConfigFctix to enter the Input Method Configuration dialog box.

  • After entering the Input Method interface, select the + sign
  • Enter the Add input method interface, click off Only Show Current Language below (important), search Baidu Pinyin in the search bar, select it and add it (it is recommended not to move the Chinese input method to the first place)
  • Enter the Global Config interface, set the Trigger Input Method to Lctl and Empty, and set the Scroll between Input Method to CTRL_SHIFT. Use Ctrl to switch input methods. (I used to use Ctrl+Tab to switch input methods in Ubuntu 16.04. Unfortunately, many attempts here failed to achieve the same effect, so I can only do it. If you know how to set it to Ctrl+Tab to switch input methods, please Let me know, thank you!)

05-Disk usage

As mentioned earlier, the system disk is installed on the SSD disk, and documents and other data are retained on the SATA disk. For example, there is a 1T SATA disk in the environment for storing important data. This way, if an accident occurs one day and the system cannot be started, there is no need to worry about the loss of important data.
First divide SATA into 2-3 partitions according to needs, and then format them into ext4 format.
Use the sudo blkid /dev/sdx1 command to obtain the UUID of partition sdx1, and add the following content to the /etc/fstab file: UID
="4657969d-2896-4a1a-9e55-2d9fe3b770d4" /home/user/Documents ext4 defaults 0 0
will all After all partitions are added, execute sudo mount -a so that you can see that the partitions have been mounted to the corresponding mount points.
However, due to permission issues at this time, the current non-root user cannot perform read and write operations.
Execute the command
sudo chgrp -R user /home/user/Documents
sudo chown -R user /home/user/Documents
so that the mounted directory can be read and written. Note that before the mount operation, you must ensure that the folders at the mount point are empty, otherwise the data in the original folder will be hidden or overwritten (the original data is not lost, but cannot be seen after mount)

06-Remove swap partition

When the system disk uses an SSD or the memory is large enough, there is no need to use a swap partition.
You can delete the swap partition by following the steps below:

  • Enter the command sudo swapoff -v /swapfile to disable the SWAP space
  • Delete the valid swap lines in the /etc/fstab file
  • Execute the command sudo rm -rf /swapfile to delete the swapfile file

In the above operation, you can use the lsblk command to see some files or folders in the /snap directory corresponding to nearly ten virtual devices loopx. For Ubuntu 18.04 there are more than twenty virtual machine devices. Some information says that snap is a brand-new software package management method that has appeared since Ubuntu 18.04. You can decide whether you need to delete it according to your needs.

07-vim installation

sudo apt-get install vim
Everyone has their own preferences for the specific configuration, so I won’t go into details.
The color theme here recommends using hybird
to copy hybrid.vim to the .vim/colors/ directory (create one if it does not exist) and
configure it in the .vimrc file.

setbackground=darkcolorscheme hybrid

08-Time setting

Enter date in the command line terminal to see if the time is consistent with Beijing time. If it is inconsistent, set Formats to "China" in settings - Region & Language

09-Install wps

Go to the wps official website to download the latest version. After downloading, execute the command sudo dpkg -i wps-office* to install it.

Due to copyright reasons, some fonts need to be copied to the specified directory, otherwise the prompt "Some formula symbols might not be displayed correctly due to missing fonts Symbol, Wingdings, Wingdings 2, Wingdings 3, Webding 3, Webding," will appear.

First download the wps_symbol_fonts.zip file, unzip it and copy it to the directory /usr/share/fonts,
and then execute the following command to generate the index information of the font:

sudo mkfontscale
sudo mkfontdir

Run the fc-cache command to update the font cache.

sudo fc-cache

Just restart wps and the missing font prompt will no longer appear.

10-Install git

Execute the command apt install git -y

11-Install zsh

Execute the command apt install zsh -y
and then execute the command to install oh-my-zsh

sh -c “$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)”

or

sh -c “$(wget -qO- https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)”

During the installation process, it prompts "o you want to change your default shell to zsh? [Y/n]". Just enter Y. However, the switch may not be successful.
In this case, you need to switch manually.

whereis zsh
chsh -s /usr/bin/zsh

Change the theme by modifying the value of ZSH_THEME in the ~/.zshrc file
(the theme file is in the ~/.oh-my-zsh/themes directory)

In addition, you can command aliases in the text, for example, as follows

vi = "force"

After restarting, you can use the command echo $SHELL to check whether the shell currently used by the system has changed to zsh.

12-Development tools installation

12-01 JetBrains Toolbox App

If it involves Java language development, it is recommended to install Toolbox first. This software can manage all Jet Brains software.
(Java needs to be installed before this installation)

Unzip the compressed package and execute it using ./jetbrains-toolbox to complete the installation.

After installation, some configurations can be modified.

Toolbox App Updates
Update Toolbox App automatically - Cancel. Just manually select whether you need to upgrade when needed.
Appearance & Behavior
Run at login - Cancel. We don't want it to run as soon as we start up and log in.

After that comes the choice of development tools.
Usually install the free community version.
For example, after selecting IntelliJ IDEA Community, click Install. There will be an information prompt in the upper right corner of this tool (usually the download prompt first)

13-Install java development and compilation related software

13-01 Oracle jdk 1.8 installation

First, you need to go to the website or other places to download the jdk that needs to be installed locally.

sudo tar -zxf jdk-8u241-linux-x64.tar.gz -C /usr/local
sudo update-alternatives --install “/usr/bin/java” “java” “/usr/local/jdk1.8.0_241/jre/bin/java” 1
sudo update-alternatives --install “/usr/bin/javac” “javac” “/usr/local/jdk1.8.0_241/bin/javac” 1
sudo update-alternatives --set java “/usr/local/jdk1.8.0_241/jre/bin/java”
sudo update-alternatives --set javac “/usr/local/jdk1.8.0_241/bin/javac”

After installation is complete, modify the following content in /etc/profile

JAVA_HOME=/usr/local/jdk1.8.0_241
JRE_HOME=/usr/local/jdk1.8.0_241/jre
PATH=$PATH:$HOME/bin:$JAVA_HOME/bin:$JRE_HOME/bin
CLASSPATH=.:$JAVA_HOME/lib:$JRE_HOME/lib
export JAVA_HOME
export JRE_HOME
export CLASSPATH
export PATH

13-02 maven installation

sudo tar -zxf apache-maven-3.3.9-bin.tar.gz -C /usr/local

After the installation is complete, modify the following content in /etc/profile

PATH=/usr/local/apache-maven-3.3.9/bin:$PATH

13-03 thrift installation

(The version installed here is 0.13.0)

First install the relevant dependencies (refer to http://thrift.apache.org/docs/install/debian)

sudo apt-get install automake bison flex g++ git libboost-all-dev libevent-dev libssl-dev libtool make pkg-config

When installing thrift-0.9.3 in UBUNTU20.04 version,
the following error occurred when executing ./configure (no corresponding solution was found):

checking for setsockopt in -lsocket… no
checking for BN_init in -lcrypto… no
configure: error: “Error: libcrypto required.”

No similar errors occurred when installing using thrift-0.13.0 version.
The installation steps are as follows:

tar -zxf thrift-0.13.0.tar.gz
cd thrift-0.13.0
./configure
make
sudo make install
Confirm the installation results and version information:
$thrift -version
Thrift version 0.13.0

13-03 protobuf installation

(The version installed here is 3.12.3)
Note that proto2 and proto3 are incompatible, so pay attention to the version used by the project.
(The highest version of proto2 is protobuf-2.6.1)
The github address is

https://github.com/protocolbuffers/protobuf

Download the latest release version (Protocol Buffers v3.12.3)

tar -xvf protobuf-all-3.12.3.tar.gz
cd protobuf-3.12.3
./configure --prefix=/usr/local/protobuf
make
make check
sudo make install

After the installation is complete, configure the environment variables and modify the following content in /etc/profile

PROTOBUF_HOME=/usr/local/protobuf
PATH=$PROTOBUF_HOME/bin:$PATH

After the changes are completed, execute the following command

source /etc/profile

Confirm the installation results and version information

protoc --version
libprotoc 3.12.3

14-Common tools installation

14-01 Screenshot tool

The flameshot screenshot tool we use here is more powerful than Screenshot.
Use apt-cache show flameshot to check the version of flameshot.
Just install it directly with the following command.

sudo apt-get install flameshot

After installation, set the default file saving name according to your needs in the Configuration-Filename Editor.

14-02 tmux

A powerful split-screen processing software that feels easier to use than screen

sudo apt-get install tmux

It should be noted here that tmux does not share the system clipboard by default. If you install tmux, you can check the configuration method online (different versions of tmux have different configuration methods).
For example: What is installed in this environment is

tmux -V
tmux 3.0a

Execute the command sudo aptitude install xclip
and make the following configuration in .tmux.conf

bind-key -T copy-mode-vi v send-keys -X begin-selection
bind-key -T copy-mode-vi y send-keys -X copy-selection-and-cancel
bind-key -T copy-mode-vi r send-keys -X rectangle-toggle
bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel “xclip -i -f -selection primary | xclip -i -selection clipboard”

Use Ctrl+b, [ to enter copy mode, select the area to be copied by moving and pressing v, use y to copy after selection, and then use Ctrl+Shift+v to paste elsewhere.

14-03 Sublime Text 3

Code editor software
official website address:

https://www.sublimetext.com/3

  • Download sublime_text_3_build_3211_x64.tar.bz2, and then extract it to the /opt directory. Refer to the command tar -jxf sublime_text_3_build_3211_x64.tar.bz2 -C /opt
  • Replace the folder with the command: mv sublime_text_3 /opt/sublime_text
  • Execute the command sudo cp -a /opt/sublime_text/sublime_text.desktop /usr/share/applications
  • Execute the command sudo chown root:root /usr/share/applications/sublime_text.desktop
  • Modify the location of the icon sudo vi /usr/share/applications/sublime_text.desktop
    (Icon=/opt/sublime_text/Icon/256x256/sublime-text.png)
  • Execute /opt/sublime_text/sublime_text to start sublime and add it to commonly used toolbars

This tool is relatively powerful, and there are many configurations available online. You can configure it according to your own preferences.

14-03 Meld

A tool for comparing and merging files.
Search for Meld in Ubuntu software and install it.

14-04 Virtual Machine Manager

An intuitive virtual machine monitoring program software. If you need to frequently connect to the kvm virtual machine on the node during work (especially if you need to see the operation interface of the virtual machine), it is recommended to install this tool.

apt-get install virt-manager

14-05 shellcheck

Used for checking shell scripts, essential for writing high-quality shell scripts

sudo apt-get install shellcheck

15-System Optimization 2

15-01 Remove installed software

Open Ubuntu Software and delete games, Mahjong, LibreOffice and other software from the Installed list.

15-02 Remove unnecessary software packages

Use the command apt autoremove for automatic removal

uninstall
sudo apt-get remove ibus
remove ibus
sudo apt-get purge ibus

15-03 Terminal background color setting

Bring up the terminal menu and set the background color value in Perferences to bean paste green (the sixteen-digit code is #C7EDCC)

summary

As Ubuntu continues to be updated, the interface is becoming more and more beautiful. Of course, there are many areas for Ubuntu optimization. Due to my limited ability, it is impossible not to test and list them one by one. Please set them according to your preferences during use.

Please leave a message if the description in the document is inaccurate, thank you.

Guess you like

Origin blog.csdn.net/haiqinma/article/details/107019702