当前位置:网站首页>Centos8 operation record command version Yum redis MySQL Nacos JDK
Centos8 operation record command version Yum redis MySQL Nacos JDK
2022-06-28 01:41:00 【privateobject】
stay centos8 On your server , Set up the operation records of the project environment , Operation command record .
- Disk mount ;
- yum Configuration source -centos-8;
- System language switching ;
- User or group management ;
- Firewall configuration ;
- Deploy jdk-8u201-linux-x64.rpm;
- install nginx-1.22.0-1.el8.ngx.x86_64;
- install redis-4.0.9;
- Deploy nacos-server-2.1.0;
- install mysql-8.0.29-1.el8.x86_64;
Reference resources
CentOS install MySQL Detailed explanation
centos7 Disk mount
Centos A complete graphic tutorial for attaching a hard disk ( see 、 Partition 、 format 、 mount ) disk
CentOS 8 On MySQL 8.0 Installation, deployment and configuration tutorial
centos8 install mysql8.0.22 course ( Hyperdetail )
linux(CentOS) install mysql Detailed explanation
centos7 Start a service as a normal user or specify a script
linux centos8 nologin User execution crontab command
CentOS Let a user have no login permission
CentOS User and user group management
Centos 7 File directory permissions chmod、 Change owner and owning group chown、umask、 Hidden permissions lsattr/chattr
Use nginx Do database port forwarding
nginx Port forwarding is realized through four layer proxy
mysql 8 create user_MySQL8.0 Creating users and authorizations
Operation record
Disk mount
# disk Mounting situation
df -kh
df /var/lib/ -kh
fdisk -l
# Information used to list all available block devices
lsblk
lsblk -f
### Create partitions ###
parted /dev/vdb
##########vvv
(parted) ? # You can view all commands
(parted) mklabel # Create a disk label , Set the label format to GPT
New disk label type? gpt # Large partition type , It seems to support 18EB
(parted) mkpart # Create partitions
Partition name? []? # Specify the partition name , Directly enter
File system type? [ext2] xfs # Specify partition type , Can store large files
Start? 0 # Specify starting position
End? 500G # Specify the end position ( It can also be written 100G, Repeat to create a second partition , It can also be used for standby )
# The generated partitions are not aligned properly for optimal performance . Ignore / Cancel ?
Warning: The resulting partition is not properly aligned
for best performance. 34s / 2048s != 0s
Ignore/Cancel? cancel
# Input is 2048 A sector , instead of 2048 byte , Neither 2048 Megabytes
(parted) mkpart primary 2048s 100% # Partition in an aligned manner , Lifting performance
# Check that the partitions are aligned
(parted) align-check optimal 1
1 aligned
(parted) p # display partition information
(parted) q # sign out
##########
lsblk # Check the hard disk information again , Confirm
mkfs.xfs /dev/vdb1 # format
lsblk -f # see uuid
# [[uuid]]
blkid -s UUID /dev/vdb1 # see uuid
# Create mount directory , The directory location is arranged randomly
mkdir [[ Mount Directory ]]
# Make a backup , The file is corrupted , It can be remedied as long as the system is not restarted
cp /etc/fstab /etc/fstab.bak
cat /etc/fstab
mount -U [[uuid]] [[ Mount Directory ]]
# Check whether to mount
df -h
# Permanent mounting method 1
########## This is a line of command. Enter, please ignore , The middle space cannot be missing
echo UUID=[[uuid]] [[ Mount Directory ]] xfs defaults 0 0 >> /etc/fstab
vim /etc/fstab # Edit content alignment
##########
## Format
# First column : Device name UUID=1276eec6-7141-4858-9f37-9ab1d4c7b602( use /dev/sdb1 It's OK )
# Second column : Device mount Directory /mnt/data/ ( Created by yourself before mounting )
# The third column : Device file system xfs ( I set it myself when I made the partition )
# The fourth column : Mount parameters defaults ( Just choose the default , There are too many others )
# The fifth column : Indicate whether to back up 0 (0 For no backup ,1 For backup , General root partition backup )
# The sixth column : Indicate the sequence of self tests 0 (0 For not self checking ,1 perhaps 2 For self inspection , If the root partition is 1, Other partitions can only 2)
# disk Mounting situation
df -kh
df /var/lib/ -kh
fdisk -l
yum Configuration source
# Use Ali's source , Because no wget Therefore, using curl download
curl -O http://mirrors.aliyun.com/repo/Centos-8.repo
ll
pwd
cp Centos-8.repo /etc/yum.repos.d/CentOS-Base.repo
yum -y install wget
# yum It's ready to use
wget --help
# For newly deployed servers , Also recommended upgrade All software packages , The latest security patch has been obtained
yum -y upgrade
# After the update , You need to back up the source , And reuse alisource
mv /etc/yum.repos.d/CentOS-* /etc/yum.repos.d/bak/
# rm -rf /etc/yum.repos.d/CentOS-* # Or delete
cp Centos-8.repo /etc/yum.repos.d/CentOS-Base.repo
# :%s/ The original / Target text /g # Global replacement , Replace the original text with the target text
yum -y install vim
yum -y install tar
yum -y install telnet
yum -y install make
System language cut - chinese
yum -y install langpacks-zh_CN
yum -y install glibc-langpack-zh.x86_64
locale -a
# see localectl Whether there is
type localectl
vi /etc/locale.conf
#######vvv
LANG="zh_CN.UTF-8"
#######
# Configuration takes effect , Restart or reload the configuration
# reboot or source /etc/locale.conf
. /etc/locale.conf
locale # Has to take effect
User or group management
# establish z-ssh User group
groupadd -g 220520 z-ssh
# Group list
cat /etc/group
# Create users and assign groups adduser or useradd
adduser -g z-ssh z-user
# User list
cat /etc/passwd
# Set the password
passwd z-user
# User switching
su z-user
su root # Password required
# Do not log in to the user :
groupadd -g 4444 no-login
#-s As the default shell, Default give shell, But don't log in shell
useradd -g no-login nacos -s /sbin/nologin
useradd -g no-login redis -s /sbin/nologin
useradd -g no-login mysql -s /sbin/nologin
Deploy jdk、nacos
Refer to another blog
Linux-centos Installation on nacos And delay self starting
# Download from the Huawei image website java
wget https://repo.huaweicloud.com/java/jdk/8u201-b09/jdk-8u201-linux-x64.rpm
# wget https://repo.huaweicloud.com/java/jdk/8u201-b09/jdk-8u201-linux-x64.tar.gz
# Search for openjdk, The current server does not have jdk, so jdk Don't worry about the priority of
yum search openjdk
# install jdk8
rpm -ivh jdk-8u201-linux-x64.rpm
java -version
# Search for java
find / -name java
# /usr/java/jdk1.8.0_201-amd64/bin/java
# /usr/java/jdk1.8.0_201-amd64/jre/bin/java
vim /etc/profile
#######vvv
# java
export JAVA_HOME=/usr/java/jdk1.8.0_201-amd64
export JRE_HOME=/usr/java/jdk1.8.0_201-amd64/jre
export CLASS_PATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib
export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH
#######
# Configuration takes effect
source /etc/profile
# Check the variable
echo $JAVA_HOME
nacos
wget https://github.com/alibaba/nacos/releases/download/2.1.0/nacos-server-2.1.0.tar.gz
tar -zxvf nacos-server-2.1.0.tar.gz
mv nacos /usr/local/
java -version
# Stand alone mode starts
sh /usr/local/nacos/bin/startup.sh -m standalone
ps -ef |grep nacos
netstat -lnpt|grep 8848
# Default password nacos nacos
vim /etc/nginx/conf.d/default.conf
#######vvv
location /nacos/ {
proxy_pass http://127.0.0.1:8848/nacos/;
}
#######
systemctl restart nginx
# Delay starting scripts
vim /usr/local/nacos/bin/nacos_self_start.sh
#######vvv
#!/bin/bash
echo "nacos delayed 60s start"
sleep 60
sh /usr/local/nacos/bin/startup.sh -m standalone
echo "nacos start end"
#######
chmod +x /usr/local/nacos/bin/nacos_self_start.sh
# Boot from boot
vim /etc/rc.d/rc.local
#######vvv
soure /etc/profile
# start nacos
nohup /usr/local/nacos/bin/nacos_self_start.sh &
# Power on switch to t-user User execution
#su t-user -c "nohup /usr/local/nacos/bin/nacos_self_start.sh &"
#######
chmod +x /etc/rc.d/rc.local
sh /usr/local/nacos/bin/shutdown.sh
systemctl enable rc-local # Enable
systemctl start rc-local # start-up
systemctl status rc-local # To obtain state
vim /usr/local/nacos/conf/application.properties
#######vvv
nacos.logs.path=./logs/nacos
#######
install nginx
Linux-Centos To configure nginx Boot up
# download nginx Of rpm package
wget http://nginx.org/packages/centos/8/x86_64/RPMS/nginx-1.22.0-1.el8.ngx.x86_64.rpm
# install
rpm -ivh nginx-1.22.0-1.el8.ngx.x86_64.rpm
# rpm Installation mode nginx The default installation location is /etc/nginx/ Under the table of contents
ll /etc/nginx/
# start-up nginx
systemctl start nginx
# Boot from boot
systemctl enable nginx
ps -ef|grep nginx
# The master configuration /etc/nginx/nginx.conf
# journal /var/log/nginx/access.log
# To configure /etc/nginx/conf.d/*.conf
# Static page /usr/share/nginx/html
# /usr/sbin/nginx -c /etc/nginx/nginx.conf
# Test configuration /usr/sbin/nginx -t -c /etc/nginx/nginx.conf
# restart /usr/sbin/nginx -s reload -c /etc/nginx/nginx.conf
systemctl restart nginx
# Check the port
netstat -lnpt|grep 80
install redis
wget http://download.redis.io/releases/redis-4.0.9.tar.gz
tar -zxvf redis-4.0.9.tar.gz
cd redis-4.0.9
make
# After successful compilation , Execution and installation
make install PREFIX=/usr/local/redis
cp redis.conf /usr/local/redis/bin/
mkdir /logs/redis
vim /logs/redis/notice.log
vim /usr/local/redis/bin/redis.conf
#######vvv
daemonize yes # Background operation
port 6379 # Listening port
requirepass password # Client connection password
bind 127.0.0.1 # Only local access is allowed , Remote connections are not allowed
logfile "/logs/redis/notice.log"
#######
/usr/local/redis/bin/redis-server /usr/local/redis/bin/redis.conf
netstat -lntp|grep 6379
ps -ef |grep redis
./redis-cli -h 127.0.0.1 -p 6379 -a password
####vvv
127.0.0.1:6379> ping
PONG
127.0.0.1:6379> info
# Server
redis_version:4.0.9
...
####
vim /etc/systemd/system/redis.service
#######vvv
[Unit]
Description=redis-server
After=network.target
[Service]
Type=forking
ExecStart=/usr/local/redis/bin/redis-server /usr/local/redis/bin/redis.conf
PrivateTmp=true
[Install]
WantedBy=multi-user.target
#######
systemctl daemon-reload # Newly added systemctl Of service take effect
systemctl enable redis.service # Set power on self start
systemctl start redis.service # start-up redis service
systemctl stop redis.service # stop it redis service
systemctl restart redis.service # Restart the service
systemctl status redis.service # View the current status of the service
systemctl disable redis.service # Stop power on and start up
install mysql
# mysql5.7 Version does not seem to support centos8
# wget https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.26-1.el7.x86_64.rpm-bundle.tar
# download mysql8.0.29
wget https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-8.0.29-1.el8.x86_64.rpm-bundle.tar
# decompression
tar -xvf mysql-8.0.29-1.el8.x86_64.rpm-bundle.tar
# various rpm Packages are dependent , So you need to install them in a certain order
rpm -ivh mysql-community-common-8.0.29-1.el8.x86_64.rpm
rpm -ivh mysql-community-client-plugins-8.0.29-1.el8.x86_64.rpm
rpm -ivh mysql-community-libs-8.0.29-1.el8.x86_64.rpm
rpm -ivh mysql-community-client-8.0.29-1.el8.x86_64.rpm
rpm -ivh mysql-community-icu-data-files-8.0.29-1.el8.x86_64.rpm
yum -y install libaio
rpm -ivh mysql-community-server-8.0.29-1.el8.x86_64.rpm
# In a simple way , You can automatically handle dependencies between packages and automatically download missing dependencies
#yum install mysql-community-{server,client,common,libs}-*
systemctl status mysqld
systemctl enable mysqld.service
systemctl start mysqld.service
ps -ef |grep mysql
netstat -lntp|grep mysql
# The first startup will create a super administrator account [email protected], The initial password is stored in the log file
grep 'temporary password' /var/log/mysqld.log
# [email protected]: password
mysql -uroot -p
#######vvv
# Change the default password
ALTER USER 'root'@'localhost' IDENTIFIED BY 'password';
# code
SHOW VARIABLES LIKE 'character%';
# Create user
create user 'test_user'@'%' IDENTIFIED BY 'password';
# Create database
create database test_db;
# User authorization
grant all on test_db.* to 'test_user'@'%';
#######
systemctl daemon-reload
Firewall configuration
systemctl enable firewalld
systemctl start firewalld
systemctl status firewalld
# Enable port
firewall-cmd --permanent --add-port=80/tcp
firewall-cmd --permanent --add-port=443/tcp
firewall-cmd --permanent --add-port=22/tcp
firewall-cmd --permanent --add-port=3306/tcp
firewall-cmd --permanent --add-port=6379/tcp
firewall-cmd --permanent --add-port=8848/tcp
firewall-cmd --reload
firewall-cmd --list-ports
# ssh Open ports 22、 Ban root long-range 、 Authorize the specified user to remote
vi /etc/ssh/sshd_config
######vvv
Port 22
# Allow any ip Visit
ListenAddress ::
AllowUsers z-user user2
# Ban root The user login
PermitRootLogin no
######
# ssh Service status
systemctl status sshd.service
# ssh restart
systemctl restart sshd.service
problem -Access denied
# perform systemctl Command error
Failed to enable unit: Access denied
###
# Solution
kill -TERM 1
边栏推荐
- How to read a paper
- Form forms and form elements (input, select, textarea, etc.)
- 手机股票开户安全吗,买股票在哪开户?
- 大尺寸导电滑环市场应用强度如何
- MapReduce elementary programming practice
- Solon 1.8.3 发布,云原生微服务开发框架
- 向excel中导入mysql中的数据表
- Review of drug discovery-02-prediction of molecular properties
- 基于可学习尺寸自适应分子亚结构的药物相互作用预测
- 药物发现综述-02-分子性质预测
猜你喜欢
药物发现综述-02-分子性质预测
Cloud assisted privacy collection intersection (server assisted psi) protocol introduction: Learning
面试官问:JS的继承
Form forms and form elements (input, select, textarea, etc.)
Google Earth engine (GEE) -- an error caused by the imagecollection (error) traversing the image collection
零基礎多圖詳解圖神經網絡
向excel中导入mysql中的数据表
自监督学习与药物发现
What is the e-commerce conversion rate so abstract?
电商转化率这么抽象,到底是个啥?
随机推荐
I/O限制进程与CPU限制进程
Is it safe to open an account online now? Novice is just on the road, ask for the answer
golang 猴子吃桃子,求第一天桃子的数量
同花顺上能炒股开户吗?安全吗?
同花顺股票开户是会有什么风险吗?同花顺开户安全吗
How about the market application strength of large-size conductive slip rings
Lodash realizes anti shake and throttling functions and native implementation
药物发现综述-03-分子设计与优化
Download, configuration and installation of MySQL
评价——秩和比综合评价
TIA botu_ Concrete method of making analog input and output Global Library Based on SCL language
Adobe Premiere基础-常用的视频特效(裁剪,黑白,剪辑速度,镜像,镜头光晕)(十五)
Evaluation - grey correlation analysis
Some problems in awk
205. 同构字符串
Web mouse click special effects case collection (red heart in live broadcast room)
基于可学习尺寸自适应分子亚结构的药物相互作用预测
模块化开发
Overview of drug discovery-01 overview of drug discovery
数据库查询优化:主从读写分离及常见问题