Installation record of Java development environment of light deepin of domestic system

A pile of nonsense written in front

Good ape! With the rise of domestic systems, I believe more and more people are understanding deepin or Tongxin UOS. As a qualified developer, how can we not have great interest. So I decided to toss and install the system as Windows11 + deepin. After the system is installed, the development environment will always go through a wave, so keep it down and avoid other players stepping on the pit I stepped on. Just let me go on the difficult road alone. [dog head] [dog head]

Note: the latest system environment at the time of this installation (2021.10.23) is (deepin 20.2.4), so the author also builds the environment in this environment. I hope you will pay attention.

1, What is deepin?

If you know that you like to look at pictures, let's start with a few pictures (talking about birds without pictures)


The first point that all articles will have. What is deepin?
Please read with me: d (guo) e (chan) e (xi) p (tong) i (zhi) n (guang).
As most people on the Internet say, it basically meets the needs of daily work. However, after my field test, the stability needs to be improved (it gets stuck for no reason from time to time, and can only be solved by powering off and restarting). Of course, we should give some encouragement to the deep team and believe that it will get better.
That's the nonsense. Let's start the practice. Please follow up.

2, Environment installation

1. Installation of JDK and Maven

java environment how less jdk installation.
As of the current date, the official release version of Java (Java 17), however, this article uses the classic jdk8 (you can send it, I use java8)
Official path

Maven uses the latest official version
Maven


Unzip the downloaded files
The code is as follows (example):

# decompression
tar -zxvf jdk-8u301-linux-x64.tar.gz
tar -zxvf apache-maven-3.8.3-bin.tar.gz
# Move to installation directory
cd /usr/lib
sudo mkdir jvm
sudo mv jdk1.8.0_301/ /usr/lib/jvm/jdk1.8.0_301
# Move maven to the specified directory
sudo mv /home/user/Downloads/apache-maven-3.8.3 /usr/local/dev-env/apache-maven-3.8.3

Enter the maven installation directory and create the repo warehouse folder as the warehouse storage address.

Modify the warehouse address of setting.xml file under conf

<localRepository>/usr/local/dev-env/apache-maven-3.8.3/repo</localRepository>

Add to environment variable

sudo vim /etc/bash.bashrc

Insert the following configuration at the end of the file

JAVA_HOME=/usr/lib/jvm/jdk1.8.0_301
CLASSPATH=.:$JAVA_HOME/lib.tools.jar
M2_HOME=/usr/local/dev-env/apache-maven-3.8.3
PATH=$JAVA_HOME/bin:$M2_HOME/bin:$PATH
export JAVA_HOME CLASSPATH M2_HOME PATH

As shown in the figure:

Enter the command to make the configuration effective

source /etc/bash.bashrc

Test for successful installation.

So far, it's done.

2.node installation

Under the influence of the environment of separation, how can an excellent back-end developer not understand the front-end technology.

Download node installation package
node

Unzip the installation package and move it to the installation directory

# decompression
tar -zxvf node-v16.11.1-linux-x64.tar
# Move to installation directory
sudo mv node-v16.11.1-linux-x64/ /usr/local/dev-env/node-v16.11.1-linux-x64
# Set soft link
sudo ln -s /usr/local/dev-env/node-v16.11.1-linux-x64/bin/npm /usr/local/bin/ 
sudo ln -s /usr/local/dev-env/node-v16.11.1-linux-x64/bin/node /usr/local/bin/
# Install cnpm
npm install -g cnpm --registry=https://registry.npm.taobao.org
# Set soft connection
sudo ln -s /usr/local/dev-env/node-v16.11.1-linux-x64/bin/cnpm /usr/local/bin/
# Set source address
npm config set registry https://registry.npm.taobao.org/
# View original address
npm config get registry

Note: node needs to set soft link to use the global command

After setting node, you can use the node command and npm command

Next, you can install vue.

Please pay attention to the domestic Taobao image address configured above, otherwise the installation may fail due to network problems.

# Installing vue/cli
sudo npm install -g @vue/cli
# Create soft link
sudo ln -s /usr/local/dev-env/node-v16.11.1-linux-x64/bin/vue /usr/local/bin

To use the vue command globally, you also need to set up soft links

At this point, you can play vue happily.

Add a few commands.
The latest vue3 commands cannot be used because the previous installed version is too low. Unable to uninstall and reinstall.
Just let me step on the pit.
If you follow my steps to build, all are the latest versions and will not enter the pit. Please feel free to rush forward.

# View all upgradeable versions
npm view npm version
# npm upgrade
npm install npm -g
# Delete soft link
rm -rf [[soft link address]
# Modify soft links
ln -snf [New target directory] [soft link address]

3.git installation

As a more popular code management tool, how can you not use git.

# Install git
sudo apt-get install git

Here, git installation is over.
Yes, it's that simple. I don't believe you see:

4.docker installation

To the top of the list.
I believe you don't want to leave when you see it.
Let's start.

I don't know why everyone on the Internet puts uninstallation at the front. Anyway, I haven't installed my new system before, so it's natural not to uninstall.

# Uninstall the original docker
sudo apt-get remove docker.io docker-engine

If you haven't installed it like me, start from this step.

# Install related tools
sudo apt-get install apt-transport-https ca-certificates curl python-software-properties software-properties-common

Pay attention here, because there is a key point here.
Here I encountered a problem: "there is no available package Python software properties, but it is referenced by other packages."
Try to remove the installation of Python software properties package.
I found that removing the installation of this package has no impact on the future. So, try it boldly.

# Installation key
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add -
# Check whether the secret key is successfully installed
sudo apt-key fingerprint 0EBFCD88
# Add docker official warehouse
# Create a new docker.list file using deepin's default editor and open it
sudo deepin-editor /etc/apt/sources.list.d/docker.list 
# Write a message as follows:
# Here Buster is the code of debain version, deepin20 is debain 10, and the code is buster. Save it after editing
deb [arch=amd64] https://mirrors.ustc.edu.cn/docker-ce/linux/debian buster stable 
# Update warehouse
sudo apt update

So how do I view my debian version
If you use the same system version as mine, you don't have to read it

cat /etc/debian_version

You can install it now. Before installing, you can also see the version that can be installed at present

see docker-ce Version of
sudo apt-cache madison docker-ce

But I think it's better to install the latest version by default. Of course, I do the same. If necessary, you can specify the version number for installation.

install docker
apt install docker-ce docker-ce-cli containerd.io

Wait until the installation is complete to see if it is successful

# View installation version information
docker version

As shown below:

Although it has been installed here, docker execution requires administrator privileges, and adding sudo every time is very troublesome.
Therefore, simply add the current user to the docker group so that the command can be executed normally.

#Set account to docker user group
sudo usermod -aG docker $USER

Here, it can be used normally. However, it is only normal. In order to use it smoothly, it is essential to modify the domestic image source. Otherwise, you may crash because of the turtle speed card (who makes the service all abroad).

# Modify domestic image source
# Open the file using the default editor, or create the file if it does not exist
sudo deepin-editor /etc/docker/daemon.json 
# Write the following
{
  "registry-mirrors": ["https://registry.docker-cn.com"]
}

Some people like to load on demand, so turn docker on and off.

# Prohibit startup and self start
# Install chkconfig
sudo apt-get install chkconfig
# Remove bootstrap
sudo chkconfig --del docker

5. Docker compose installation

Now that docker is installed, life is always incomplete without installing this thing.
It's not too hard anyway. Let's do it.

# Note the version number here (v2.0.1)
sudo wget -c -t 0 https://github.com/docker/compose/releases/download/v2.0.1/docker-compose-`uname -s`-`uname -m` -O /usr/local/dev-env/docker-compose
# Add execution permission
sudo chmod a+rx /usr/local/dev-env/docker-compose
# Create soft link
sudo ln -s /usr/local/dev-env/docker-compose /usr/local/bin/
# Check whether the installation is successful
docker-compose -v

Uninstall is easier. After testing, the default folder will also be deleted, which is very convenient.

# Uninstall docker compose
sudo rm /usr/local/dev-env/docker-compose

6.mysql installation

After seeing this, you don't think you will download the installation package - > extract - > configure environment variables - > set the environment to take effect as before
So much trouble.
Our docker is not for reading. We should let it play its due role.

# Pull image
docker pull mysql:5.7.36
# Create a local mapped folder within the container
mkdir -p /root/mysql/data /root/mysql/logs /root/mysql/conf
# Initialize the mysql configuration file *. cnf in / root/mysql/conf
touch /root/mysql/conf/my.cnf
# Create a docker container and start it to map data, logs and configuration files to the local machine
docker run -p 3306:3306 --name mysql -v /root/mysql/conf:/etc/mysql/conf.d -v /root/mysql/logs:/var/log/mysql -v /root/mysql/data:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=root -d mysql:5.7.36
# Check whether the service is started
docker ps

If there is no problem here, you should see that mysql has been started and running

Are you a little worried about whether this thing can be used or not
Let's test it.

# Log in to the docker container
docker exec -it 6f0977e8 /bin/bash


See here, we have entered the container
Then test whether the login to mysql is successful

See here to prove that our database service is no problem.
Don't you believe it? Let's connect to the client.

I inserted a table and several test data. Sure enough, there is no problem.
You may have a question. Will the data be lost after we stop the service?
Of course not. If you lose data, you will lose the meaning of containerization. Remember that we configured data local mapping. Let's see if the file is persisted locally.

sudo ls /root/mysql/data/


Sure enough, the data will not be lost. If you don't believe it, you can stop the service and try opening it again.
Data is still that data. It just changes people's hearts.

summary

So far, a weekend without king glory and hero League has passed.
Just taking advantage of today's beautiful festival, I wish your brothers and sisters black hair.
Still think, after not playing a game, lung capacity is better than before. I wrote so much in one breath.
From the foreground, to the background, and finally to persistence, a basic development environment has been completed.
What tools will be used later to update.
Friends can write code happily.
Support domestic light, don't you use it quickly.

Tags: Java Docker Vue deepin

Posted on Sun, 24 Oct 2021 06:54:17 -0400 by sepodati