Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Introduction of Deepin Linux how to build MySQL, JDK, Maven and Git development environment

2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

I don't know if you know anything about Deepin Linux's previous articles on how to build MySQL, JDK, Maven, and Git development environments. Today I'm here to tell you a little bit about it. If you are interested, let's take a look at the body. I believe you will gain something after watching how Deepin Linux builds MySQL, JDK, Maven and Git development environments.

First, set up MySQL8

Reference link: https://blog.csdn.net/jdbdh/article/details/92840742

(1) check dependencies:

Deepin15.11 already has libaio1 installed by default, execute the following command:

Sudo apt install libaio1

Note: if it is installed, it will be ignored automatically

(2) download the installation package

You can use the following command (Note: if the curl command is not available, you can install curl through sudo apt install curl):

Curl-L https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-8.0.16-linux-glibc2.12-x86_64.tar.xz-O

Or visit the website https://dev.mysql.com/downloads/mysql/

Note: the measured version 8.0.16 can be installed normally, but if there is a problem with 8.0.18, the former is recommended.

(3) decompress the installation package

Tar-xJvf mysql-8.0.16-linux-glibc2.12-x86_64.tar.xz

Note: the above command is downloaded to the current directory as an example, please refer to the actual situation.

(4) move the extracted directory to the / usr/local directory

Sudo mv. / mysql-8.0.16-linux-glibc2.12-x86_64 / usr/local/mysql

Note: the configuration file does not need to be manually adjusted when the target directory is / usr/local/mysql. This method is recommended.

(5) create mysql groups and users

Sudo groupadd mysql

Sudo useradd-r-d / usr/local/mysql-g mysql mysql

(5) enter the target directory to perform initialization

The operation process is as follows:

Deepin:~/Downloads$ cd / usr/local/mysqldeepin:/usr/local/mysql$ lsbin include LICENSE man README.router share vardocs lib LICENSE.router README run support-files:/usr/local/mysql$ sudo bin/mysqld-initialize-user=mysql2019-12-28T14:54:54.917880Z 0 [System] [MY-013169] [Server] / usr/local/mysql/bin/mysqld ( Mysqld 8.0.16) initializing of server in progress as process 65592019-12-28T14:55:01.954598Z 5 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: lZN/) lOz52019-12-28T14:55:04.812510Z 0 [System] [Server] / usr/local/mysql/bin/mysqld (mysqld 8.0.16) initializing of server has completed

Note: write down the initial password generated for the root user, use it when logging in for the first time, and then change it to the desired password

(6) start MySQL

The operation commands are as follows:

Deepin:/usr/local/mysql$ sudo bin/mysqld_safe-- user=mysql &

(7) modify root password

The operation process is as follows:

Deepin:/usr/local/mysql/bin$. / mysql-u root-pEnter password: Welcome to the MySQL monitor. Commands end with; or\ g.Your MySQL connection id is 12Server version: 8.0.16Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type 'help;' or'\ h' for help. Type'\ c'to clear the current input statement.mysql > ALTER USER 'root'@'localhost' IDENTIFIED BY' newPassword@123';Query OK, 0 rows affected (0.02 sec) mysql > flush privileges;Query OK, 0 rows affected (0.01 sec) mysql > quitBye

The above procedure is only to change the root password, and then you need to stop MysQL (check the process number first and then kill). The operation process is as follows:

Deepin:/usr/local/mysql$ ps-ef | grep mysqlroot 14854 14190 0 14:36 pts/1 00:00:00 sudo bin/mysqld_safe-- user=mysqlroot 14855 14854 0 14:36 pts/1 00:00:00 / bin/sh bin/mysqld_safe-- user=mysqlmysql 14926 14855 0 14:36 pts/1 00:00:01 / usr/local/mysql/bin/mysqld-basedir=/usr/local/mysql-datadir=/usr/local/mysql/data-plugin -dir=/usr/local/mysql/lib/plugin-user=mysql-log-error=Deepin.err-pid-file=Deepin.pidmyuser 15063 9348 0 14:39 pts/0 00:00:00 grep mysqlherov@Deepin:/usr/local/mysql$ sudo kill 14926

(8) configure MySQL as a service

Create the configuration file mysqld.service under the / usr/lib/systemd/system/ directory

Sudo vi / usr/lib/systemd/system/mysqld.service

Examples are as follows:

[Unit] Description=MySQL ServerAfter=network.target local-fs.target remote-fs.target [Service] Type=forkingPIDFile=/usr/local/mysql/data/Deepin-pc.pidExecStart=/usr/local/mysql/support-files/mysql.server startExecStop=/usr/local/mysql/support-files/mysql.server stopExecReload=/usr/local/mysql/support-files/mysql.server restartUser= mysql[Install] WantedBy=multi-user.target

Note: the file name Deepin-pc.pid of the above PIDFile is the process file name when the hostname is Deepin-pc, which requires the hostname + pid. The hostname can be found through the hostname command. If the process filename is inconsistent with hostname, subsequent Mysql services may fail to start.

After that, you can join the self-starting service through the command line:

Sudo systemctl enable mysqld.service

After that, if you start the service manually, then:

Sudo systemctl start mysqld.service

(9) set mysql users to use only the no login mode

To prevent external mysql users from accessing the system, set the mysql user to not log in, for example, set the login shell to bin/false:

Deepin:/usr/local/mysql$ sudo usermod-s / bin/false mysql

(10) create an ordinary user. The example is as follows:

Mysql > create user 'myapp'@'192.168.0._' identified by' password';Query OK, 0 rows affected (0.02 sec)

Note: the above userName is the user to be modified, and 192.168.0.0 _ indicates the host that matches the 192.168.0 network segment.

(11) modify the password of an ordinary user. An example of the operation process is as follows:

Mysql > alter user 'userName'@'%' identified by' Abcdef';Query OK, 0 rows affected (0.19 sec)

Mysql > flush privileges;Query OK, 0 rows affected (0.00 sec)

Note: the above userName is the user to be modified, and% indicates any host

(12) for other authorization-related operations, please refer to:

Https://blog.csdn.net/Coke_uncle/article/details/93631110

Https://blog.csdn.net/wyq232417/article/details/88753365

Example 1 (granting permissions to all libraries and tables for mydba users, and all grantable permissions that can be assigned to other users):

Grant all privileges on *. * to 'mydba'@'192.168.0._' with grant option

Example 2 (grant myapp users select,insert permissions for all tables for which Database is app)

Grant select, insert on app.* to 'myapp'@'192.168.0._'

To revoke authorization, use the revoke command, for example:

Revoke select on app.* to 'myapp'@'192.168.0._'

(13) Delete users

Drop 'username'@'host'

(14) View the list of users

Select distinct concat ('User:'', user,'''@''',host,''';') AS query FROM mysql.user

(15) View the permissions of a user

Show grants for 'mydba'@'192.168.0._'

(16) modify the host login attributes of a user. An example of the operation process is as follows:

Mysql > update mysql.user set host ='% 'where user =' myapp';Query OK, 1 row affected (0.04 sec) Rows matched: 1 Changed: 1 Warnings: 0mysql > flush privileges;Query OK, 0 rows affected (0.01 sec)

(17) use DBeaver to connect to MySQL8

Using dbeaver to connect to MySQL8, the default configuration is often reported as "PublicKeyRetrieval is not allowed". You need to modify the driver properties when connecting, "edit driver settings", and change the parameter allowPublicKeyRetrieval to true; and then reconnect.

Second, set Deepin to make shell support ll and other shortcut commands, and set vim to support mouse copy and paste

Reference: https://bestsort.cn/2019/08/08/890/

Edit the configuration file:

Sudo vi / etc/bash.bashrc

Append the following to the end of the file:

Alias tailf= "tail-f-n" alias ls= "ls-- color=auto" alias ll= "ls-alF"

After saving the above file, execute:

Source / etc/bash.bashrc

Execute the following command:

Vim / .vimrc

Enter the following in the open file and save:

Set mouse-=a

After that, the text in vim can be selected and pasted and copied with the right mouse button.

Third, install JDK

(1) download Oracle JDK

Refer to download link: https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

You need to pay attention to downloading the package of xxx.tar.gz to Deepin, such as jdk-8u231-linux-x64.tar.gz

(2) decompress the installation package

Tar xvf jdk-8u231-linux-x64.tar.gz

(3) move the extracted directory to the / usr/local directory

Sudo mv. / jdk1.8.0_231 / usr/local/java

(4) set environment variables

Reference link: https://blog.csdn.net/qq_41892229/article/details/81773079

Edit / etc/profile

Sudo vi / etc/profile

Add the following:

# Add Java and Maven enviromentJAVA_HOME=/usr/local/javaexport PATH=$JAVA_HOME/bin:$PATH export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar

Fourth, install Maven

(1) download Maven

Refer to download link: http://maven.apache.org/download.cgi

Download the appropriate xxx.tar.gz package, for example: apache-maven-3.6.3-bin.tar.gz

(2) decompress the installation package

Tar zxvf apache-maven-3.6.3-bin.tar.gz

(3) move the extracted directory to the / usr/local/maven directory

Sudo mv. / apache-maven-3.6.3 / usr/local/maven

(4) set environment variables

Edit / etc/profile

Sudo vi / etc/profile

The sum with the Java environment variable is as follows:

# Add Java and Maven enviromentJAVA_HOME=/usr/local/javaMAVEN_HOME=/usr/local/mavenexport PATH=$JAVA_HOME/bin:$MAVEN_HOME/bin:$PATH export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar

Then execute the following command to make the configuration take effect:

Source / etc/profile

(5) add permanent settings

Append the contents related to JAVA and Maven environment variables in (4) above to / etc/bash.bashrc and execute:

Source / etc/bash.bashrc

The InteliJ IDEA Community version can then be installed through Deepin's App Store

(6) configure maven repository

Modify the conf/settings.xml under the maven directory and back it up before you modify it:

Cd / usr/local/maven/conf

Cp settings.xml settings.xml.bak

Then edit the settings.xml, for example:

Add Ali's maven resource image in the middle of the tag:

Alimaven central aliyun maven https://maven.aliyun.com/repository/central aliyun-maven * aliyun maven http://maven.aliyun.com/nexus/content/groups/public

And set the directory of the local warehouse in settings.xml, for example:

${user.home} / .m2/res

Note: the above tags should not be added to the comments in settings.xml, otherwise they will not take effect; in addition, if you only make settings.xml valid for the current user, you can save settings.xml in the currently used ~ / .m2 directory, and the settings.xml in this directory will be used first.

5. Install Git

(1) download and install Git bash

Execute the following command:

Sudo apt-get install git

Configure users, email:

Deepin:~$ git config-global user.name "xxxx" Deepin:~$ git config-global user.email "xxxx@yyy.com"

Configure public key and private key:

Deepin:~$ ssh-keygen-t rsa

Then enter three times to complete the creation.

View the public key and copy it to the git CVM, for example:

Herov@Deepin:~$ cd .sshherov @ Deepin:~/.ssh$ cat id_rsa.pubssh-rsa AAAAB3NzaC1yc2EAAAADA

. . .

(2) install client tools using Deepin's App Store

(3) install fonts. Some tools, such as code development environment, use courier fonts for better results. Execute the following command:

Sudo apt-get install ttf-mscorefonts-installer

6. Install PHP

1. Check that apache2 has been installed. The procedure is as follows:

(1) check the installation package

Mypc@Deepin:~$ sudo apt-get install apache2

Reading package list. Complete

Analyzing dependency tree of software package

Reading status information. Complete

Apache2 is already the latest version (2.4.25-3+deb9u6).

Apache2 has been set to install manually.

0 software packages have been upgraded, 0 new packages have been installed, 0 packages have to be uninstalled, and 18 packages have not been upgraded.

Note: if apache2 is already installed, the page can be opened by default:

Http://localhost/

(2) the operation of apache2

If you need to restart apache2, execute the following command:

Sudo / etc/init.d/apache2 restart

2. Execute the following command under the command line terminal to complete the installation of PHP:

S

Udo apt-get install php-y

3. Execute the following command to check the version of PHP:

Php-v

4. Check that PHP can be accessed properly.

Create a new php file under / var/www/html:

Sudo vi index.php

Enter in a file:

Then enter in the browser:

Http:/localhost/index.php

Check whether the page is displayed properly

After reading Deepin Linux how to build MySQL, JDK, Maven, Git development environment introduction of this article, what do you think? If you want to know more about it, you can continue to follow our industry information section.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report