CentOS7 actual combat

After using Ubuntu for a while, I feel that Baidu's support for Ubuntu is not very good, and its own English level is not enough, so try CentOS7.
After Tencent Cloud reinstalls the system, first install JDK1.8.

1 JDK installation and configuration

1.1 JDK download

Use wget to download:

# wget https://download.oracle.com/otn/java/jdk/8u231-b11/5b13a193868b4bf28bcb45c792fce896/jdk-8u231-linux-x64.tar.gz?AuthParam=1576566136_02272ddf697f45ccc1dc9050864ec743
--2019-12-17 15:13:29-- https://download.oracle.com/otn/java/jdk/8u231-b11/5b13a193868b4bf28bcb45c792fce896/jdk-8u231-linux-x64.tar.gz?AuthParam=1576566136_02272ddf697f45ccc1dc9050864ec743
Resolving download.oracle.com (download.oracle.com)... 23.42.152.56
Connecting to download.oracle.com (download.oracle.com)|23.42.152.56|:443... connected.
HTTP request sent, awaiting response... 403 Forbidden
2019-12-17 15:19:30 ERROR 403: Forbidden.

After half a day of research, remove the final '? AuthParam = 1576566136_02272ddf697f45ccc1dc9050864ec743' at the end of the download link.
After downloading, check the size

# ls -lht

Obviously the size is not right. The previous link was copied from Thunder. I suspect that Thunder handled it. I changed it to the browser and downloaded it directly, and then copied the download address of the browser.

https://download.oracle.com/otn/java/jdk/8u231-b11/5b13a193868b4bf28bcb45c792fce896/jdk-8u231-linux-x64.tar.gz?AuthParam=1576568785_c23356636ea471f35afba74a733e8d63
found the results are different, after re-downloading:

This is decent, but the download speed is too slow, and finally chose to upload after local download.

Refer to another essay for the process of uploading files from local to Linux. Having to vomit, Oracle changed the website and it became more and more difficult to download a JDK. It is recommended to back up early.

1.2 Installation

Create installation directory

# mkdir /usr/local/java

Unzip to installation directory

tar -zxvf JDK名称(Tab自动补全) -C /usr/local/java

The speed is quickly decompressed.

1.3 Set environment variables

# vim /etc/profile

Click 'I':

The word '-INSERT-' will appear at the bottom, you can insert it, insert at the end:

export JAVA_HOME=/usr/local/java/jdk1.8.0_171
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:$PATH

Here I added a comment at the front to make it easier to check later. When I entered JAVA_HOME, I forgot the version number of the JDK and opened it directly with Xftp to take a look.
Then press 'Esc'

'-INSERT-' disappears, press 'Shift +;' result is needed ':'

An input box will appear, at this time you can enter a command to save and exit:

:q 退出
:w 保存
这里是保存并退出,输入wq

After exiting, you can use the view command to check whether the editing is successful:

# cat /etc/profile

Make the environment variables effective:

# source /etc/profile

Add soft links

# ln -s /usr/local/java/jdk1.8.0_231/bin/java /usr/bin/java

an examination:

# java -version

The soft link here, I understand that I can directly use java as a command

2 MySQL installation and configuration

2.1 Add MySQL warehouse

Add warehouse: (The address can be viewed at https://dev.mysql.com/downloads/repo/yum/)

# yum localinstall https://repo.mysql.com//mysql80-community-release-el7-3.noarch.rpm

View all MySQL versions in the yum source:

# yum repolist all | grep mysql

As you can see, only MySQL 8.0 is enabled, so first disable 8.0 and enable 5.7

# yum-config-manager --disable mysql80-community
# yum-config-manager --enable mysql57-community

View after modification:

2.2 Install MySQL5.7

# yum install -y mysql-community-server

2.3 Starting Mysql and MySQL

# systemctl start mysqld.service
# systemctl enable mysqld.service

2.4 Database password

Starting from 5.7, MySQL does not allow login with an empty password after the first installation! To enhance security, the system will randomly generate a password for the administrator to log in for the first time. This password is recorded in the /var/log/mysqld.log file. Use the following command to view this password:

# cat /var/log/mysqld.log | grep 'A temporary password'

The '6ny0 # qpL = ZVj' after the colon is the temporary password.
Use this password to log in to MySQL:

# mysql -p

Enter MySQL after entering the password, but you must change the password in time:

Set the password directly:

mysql> set password=password('root')

An error is reported, prompting: ERROR 1819 (HY000): Your password does not satisfy the current policy requirements. Check to know that it is a problem with the MySQL password policy, that is, such a simple password is not allowed and the security policy is modified:

mysql> set global validate_password_policy=0;

This is to change the security verification level to LOW, which is low, and it will not be so complicated to verify;

mysql> set global validate_password_length=4;

This is to change the length of the security verification password to 4, and the length should be> = 4;
then set the password again:

mysql> set password=password('root');

Refresh permissions:

mysql> flush privileges;

After that, no error is reported:

Note: The password field is no longer in the mysql.user table in the database after mysql5.7, and the password field has been changed to authentication_string. So the command to change the password is as follows:
mysql> update mysql.user set authentication_string=password('123456') where user='root';
Query OK, 1 row affected, 1 warning (0.00 sec) Rows matched: 1 Changed: 1 Warnings: 1
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

2.5 Subsequent settings

Check the MySQL version:

mysql> select version();

Modify MySQL encoding to UTF-8:

mysql> show variables like '%character%';show variables like '%collation%';

The modification needs to exit MySQL;

# vim /etc/my.cnf

Restart MySQL after modifying and saving:

# systemctl restart mysqld.service

If an error is reported, check the error details as prompted:

# journalctl -xe

Then found a line: mysqld: Character set 'utf-8' is not a compiled character s
Baidu found a setting problem, and then will look at the steps and found that the setting should be 'utf8' not 'utf-8'

3 Install Docker

3.1 Preparation before installation

# cat /etc/redhat-release
# uname -a

Uninstall the old version:

# yum remove docker \
             docker-client \
             docker-client-latest \
             docker-common \
             docker-latest \
             docker-latest-logrotate \
             docker-logrotate \
             docker-engine

3.2 Install Docker CE

Convenient to add software source, support devicemapper storage type, understand that DeviceMapper is a mapping mechanism from logical device to physical device provided by Centos, probably glanced at the online introduction, it looks a bit stressful for me, for the time being .

# yum install -y yum-utils \
               device-mapper-persistent-data \
               lvm2

Add Docker stable version of yum software source

# yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo

Install the latest version of Docker-CE

# yum install docker-ce docker-ce-cli containerd.io

After the prompt is completed, start Docker and set the boot to start automatically

# systemctl start docker
# systemctl enbale docker

Create a docker group and add the current user to the docker group

# groupadd docker
# usermod -aG docker $USER

Test whether Docker is installed correctly:

# docker run hello-world

View Docker status

# systemctl status docker

3.3 Mirror acceleration

Because of the Tencent Cloud server used, other articles are basically Alibaba Cloud. Here is a brief note of the method of Tencent Cloud mirror acceleration.
Check whether the daemon.json file exists:

# ls /etc/docker/

Does not exist, then create a new daemon.json file:

# touch /etc/docker/daemon.json

Edit the daemon.json file:

# vi /etc/docker/daemon.json

Write content:

{
    "registry-mirrors": [
        "https://mirror.ccs.tencentyun.com"
    ]
}

Make it effective:

# systemctl daemon-reload
# systemctl restart docker

Check whether it is effective:

# docker info

At this point, Docker installation is complete.

4 Docker build Maven private server

4.1 Pull a nexus3 image

# docker pull sonatype/nexus3

4.2 Create and start a container

# docker run -d -p 8081:8081 --name nexus -v /root/nexus-data:/var/nexus-data --restart=always sonatype/nexus3

See if it is successful:

# docker inspect nexus

You can see that the values ​​of 'Gateway' and 'IPAddress' indicate that the startup is successful.
Visit it:

# curl 172.17.0.2:8081

A lot of HTML is returned in seconds.
Use the browser to access the Internet:

Because my server is very cheap, this page loads slowly ...

Finally loaded.
Click on the upper right to Sign Inlog in: the
default initial account password is: admin / admin123, but:

Because Maven private server login can not use clear text password, cipher text password is needed, enter the container to find a Kazakhstan.

# docker exec -it nexus bash
$ cd /nexus-data/
$ cat admin.password

Remove the container part, which is the password:

03649c7e-8942-45f6-9906-b0cc5dec53f5

After successful login, there will be a pop-up window:

After Google Translate:

Just next:

This does not need to be translated, please get a password for the admin user;

Then next:

This is not understandable, Google:

It probably means that anonymous access is convenient, I understand it this way, select next:

Finished, enjoy the joy of using it! Finish

The following is an explanation from:

proxy The proxy of the remote warehouse, for example, nexus is configured with a central repository proxy. When the user requests an artifact from this proxy, it will now look up locally. If it cannot find it, it will be downloaded from the remote warehouse and then returned to the user.
hosted host warehouse, users can deploy some of their own warehouses to this warehouse
group warehouse group, is a unique concept of nexus, the purpose is to integrate multiple warehouses, expose a unified address to the user, so there is no need to configure multiple warehouse addresses
Put the address here, if you have specifics, please go to the original path to check.

4.3 Create Warehouse

Click on the page Create repository, select maven2(hosted), enter the warehouse name (reason-release), select the warehouse type in the Version policy, use the default Release here, select Allow redeploy in the Deployment policy under Hosted (the original path says this is very important!)
This setting is Compile type, set to follow compilation.

4.4 Create User

Click the menu on the left menu bar User, click Create local user, fill in the contents and save.

Guess you like

Origin www.cnblogs.com/JillisRealM/p/12745136.html