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

Steps to build the Java project running environment of CentOS system

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

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

This article mainly explains the "CentOS system Java project operating environment building steps", the content of the article is simple and clear, easy to learn and understand, the following please follow the editor's ideas slowly in depth, together to study and learn "CentOS system Java project operating environment building steps" bar!

Please use the command su to switch to the root account before you start.

one。 Installation of commonly used tools

Sudo yum upate: update sourc

Yum-y install vim: a better editor than vi

Yum-y install tree: install tree, file directory structure view tool

Yum-y install lrzsz: a tool for uploading and uploading files

Yum-y install wget: a useful download tool

two。 Start installing JDK

1. Create a Java installation directory

Mkdir-p / usr/local/java & & cd / usr/local/java

2. Rz choose the local JDK package to upload

Extract JDK and delete the package: tar-zxvf jdk-8u211-linux-i586.tar.gz & & rm-rf jdk-8u211-linux-i586.tar.gz

3. Configure environment variables: vim / etc/profile

Add the following configuration at the end of the file:

# set java environment

Export JAVA_HOME=/usr/local/java/jdk1.8.0_211

Export CLASSPATH=.:$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar

Export PATH=$PATH:$JAVA_HOME/bin

Save exit

Source / etc/profile

After the configuration takes effect, java-version checks whether the configuration is correct.

three。 Install maven

1. Create a maven directory

Mkdir/ usr/local/maven & & cd / usr/mkdir/maven

two。 Download maven

Wget http://mirrors.tuna.tsinghua.edu.cn/apache/maven/maven-3/3.6.1/binaries/apache-maven-3.6.1-bin.tar.gz

3. Decompress maven

Tar zxvf apache-maven-3.6.1-bin.tar.gz & & rm-rf apache-maven-3.6.1-bin.tar.gz

4. Configure environment variables

Vim / etc/profile

Add at the end of the file

# set maven environment

Export M2_HOME=/usr/local/maven/apache-maven-3.6.1

Export PATH=$PATH:$M2_HOME/bin

Test configuration: mvn-v

5. Configure maven Repository Image

Vim / usr/local/maven/apache-maven-3.6.1/conf/settings.xml

Nexus-aliyun

Nexus aliyun

Http://maven.aliyun.com/nexus/content/groups/public/

Central

Repo2

Mirror from Maven Repo2

Http://repo2.maven.org/maven2/

Central

Uk

Mirror from UK

Http://uk.maven.org/maven2/

Central

Ibiblio.org

Ibiblio Mirror of http://repo1.maven.org/maven2/

Http://mirrors.ibiblio.org/pub/mirrors/maven2

Central

Jboss-public-repository-group

Central

JBoss Public Repository Group

Http://repository.jboss.org/nexus/content/groups/public

6. Initialize the warehouse configuration (this step is not necessary)

Mvn help:effective-settings

The default warehouse address is / root/.m2/repository

The first folder is hidden, and you need to use the ll-a parameter to see it.

four。 Install the nexus package management library

five。 Install the mysql8 database

1. Enter the installation directory: cd / usr/local

2. Upload mysql source code package on rz

Decompress

Xz-d mysql-8.0.16-linux-glibc2.12-i686.tar.xz

Tar-xvf mysql-8.0.16-linux-glibc2.12-i686.tar

Rename the mysql directory and delete the package

Mv mysql-8.0.16-linux-glibc2.12-i686 mysql

Rm-rf mysql-8.0.16-linux-glibc2.12-i686.tar

3. Create users and assign user groups to mysql in case the database is hacked to obtain root permissions, resulting in server involvement

Groupadd mysql

Useradd-r-g mysql mysql

(- r represents the system user and cannot be used to log in)

Confirm user configuration: id mysql

4. Assign the mysql directory to the mysql user you just created

Chown-R mysql:mysql / usr/local/mysql/

Go to the mysql directory and execute the mysql installation command

Cd / usr/local/mysql/

. / bin/mysqld-initialize-user=mysql-basedir=/usr/local/mysql/-datadir=/usr/local/mysql/data/

Copy the initial password of the root user above

If you forget, you can check it at sudo grep 'temporary password' / var/log/mysqld.log.

5. Install the SSL secure communication component of mysql (this step is not necessary, you can skip it, or you can turn it off in the later my.cnf)

SSL is secure, but it degrades performance!

1. Create a key directory

Mkdir-p / usr/local/mysql/ssl_rsa

two。 Generate secret key

. / bin/mysql_ssl_rsa_setup-- datadir=/usr/local/mysql/ssl_rsa/

3. Change the directory owner

Chown-R mysql:mysql / usr/local/mysql/ssl_rsa/

Introduction to 4.ssl_rsa catalog files

Ca-key.pem # CA Private key

Ca.pem # self-signed CA certificate, client connection also needs to provide

Client-cert.pem # Certificate file to be provided by the client to connect to the server

Client-key.pem # Private key file that needs to be provided for the client to connect to the server

Private_key.pem # Private member of the private / public key pair

Public_key.pem # Common members of private / public key pairs

Server-cert.pem # server-side certificate file

Server-key.pem # server-side private key file

Show variables like'% ssl%'

5. To create a my.cnf configuration file, you don't need to configure Mysql8. The default character set has been changed from latin1 to utf8mb4 (this step is not necessary, you can skip this step)

Vim / etc/my.cnf

-

[client]

Default-character-set=utf8

[mysql]

Default-character-set=utf8

[mysqld]

Max_connections=50

Init-connect='SET NAMES utf8'

Character-set-server=utf8

Default-storage-engine=INNODB

# disable_ssl

Skip_ssl

Show session variables like'% character%'

6. Configure environment variables

Vim / etc/profile

# set mysql enviroment

Export PATH=$PATH:/usr/local/mysql/bin

Source / etc/profile

7. Add to service

Cp / usr/local/mysql/support-files/mysql.server / etc/init.d/mysql

8.mysql service

Service mysql start

Service mysql stop

Service mysql restart

Security monitoring mode is started, and the configuration file may not be specified

. / usr/localhost/mysql/bin/mysqld_safe-user=mysql-default-file=./my.cnf &

9. Set boot mysql and cancel

Systemctl enable mysql.service

Systemctl disable mysql.service

10. Account configuration

After the mysql service is enabled, log in with mysql-uroot-p and the initial password, and then change the initial password

The first command is to encrypt with the new password, and the second day is to use the old encryption, which is compatible with the old version of JDBC.

ALTER USER 'root'@'localhost' IDENTIFIED BY' 123456'

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY' 123456'

11. Create a remote access account

Create a user

Create user 'remote'@'%' indentified by' 123456'

Authorization

Grant all privileges on *. * to 'remote'@'%' with grant option

Flush privileges

All permissions: ALL PRIVILEGES = SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER, CREATE TABLESPACE, CREATE ROLE, DROP ROLE

No permission: USAGE

View authorization information

Show grants for 'remote'@'%'

twelve。 The firewall port is open for access to the public network, and ports 80 and 8080 are also open.

Configure public network access

Firewall-cmd-zone=public-add-port=80/tcp-permanent

Firewall-cmd-zone=public-add-port=8080/tcp-permanent

Firewall-cmd-zone=public-add-port=3306/tcp-permanent

Refresh the firewall

Firewall-cmd-reload

View

Firewall-cmd-zone= public-query-port=3306/tcp

Remove

Firewall-cmd-zone= public-remove-port=3306/tcp-permanent

six。 Install Jenkins

seven。 Install Redis

Thank you for your reading, the above is the "CentOS system Java project operating environment building steps" content, after the study of this article, I believe you have a deeper understanding of the CentOS system Java project operating environment building steps, the specific use of the need for you to practice and verify. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

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

Internet Technology

Wechat

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

12
Report