当前位置:网站首页>So easy deploy program to server
So easy deploy program to server
2022-07-01 03:01:00 【Lingxiyun】
List of articles
Import mirror
open VMWare, Click on “ open virtual machine ”, This article chooses centos7.ova Image storage path

Click Import

choice “ Don't show this message again ”, Click on “ retry ” Button

Click on “ Edit virtual machine settings ”, Modify the processor 、 Memory 、 After hard disk and other information , start-up . Press Ctrl+Alt Key to switch to windows Next . After successful startup , Enter account root password 123456( The account and password shall be subject to the settings of the image system ), Sign in .
To configure IP Address
First in VMWare Set the network connection mode as Bridging mode

About centos7 obtain IP Address There are two main ways ,
- Get dynamic ip
- Set static ip
Get dynamic ip
The premise is that your router has Open the DHCP, Modify the network card configuration file
vi /etc/sysconfig/network-scripts/ifcfg-enp0s3
# ifcfg-enp0s3 For network card name

Get dynamic IP The address needs Two changes that will do
BOOTPROTO="dhcp"
ONBOOT="yes"

After modification restart Just click the network service systemctl restart network
[[email protected] ~]# systemctl restart network
[[email protected] ~]#
Such dynamic configuration IP The address is set , Check again at this time ip addr You can see that you have obtained IP Address ( Record the settable fixed ip), And you can go online ping www.baidu.com
Setting up ip
Or modify the network card configuration file
vi /etc/sysconfig/network-scripts/ifcfg-enp0s3
take BOOTPROTO="dhcp" Change to BOOTPROTO=“static”
BOOTPROTO="static"
Add again IP Information
IPADDR="192.168.0.121" # The setting is fixed IP
NETMASK="255.255.255.0" # Subnet mask , It doesn't need to be modified
GATEWAY="192.168.0.1" #VMware gateway IP Address
DNS1="114.114.114.114" # This is domestic DNS Address , fixed
Difficult problems
Question 1 :systemctl restart network Report errors
Job for network.service failed. See ‘systemctl status network.service’ and ‘journalctl -xn’ for details.
Question two :ping Not Baidu
terms of settlement
- exclude ip Conflict
Use host ping This ip See if it already exists .
- Delete redundant network card configuration files
Delete ifcfg-e Redundant network card configuration file at the beginning
rm -f /etc/sysconfig/network-scripts/ifcfg-eXXX
- HWADDR error , Find the correct HWADDR
Input ip addr, Find the HWADDR

Get into cd /etc/sysconfig/network-scripts Edit the corresponding table of contents vi ifcfg-ensXX, take HWADDR Set up correctly , restart service network restart perhaps Delete HWADDR.
take
ifc-ethXXMediumDEVICEThat lineComment out or deletetake
ifcfg-xxxMediumNAMEChange to be consistent with the file nameDeleteNICUUIDstop it NetworkManager.service
Stop the network management service
[[email protected] Desktop]# systemctl stop NetworkManager.service
[[email protected] Desktop]# systemctl disable NetworkManager.service
Removed symlink /etc/systemd/system/multi-user.target.wants/NetworkManager.service.
Removed symlink /etc/systemd/system/dbus-org.freedesktop.NetworkManager.service.
Removed symlink /etc/systemd/system/dbus-org.freedesktop.nm-dispatcher.service.
restart network service
[[email protected] network-scripts]# service network restart
Restarting network (via systemctl): [ OK ]
- Delete device rule profile
With or without this document , Just delete
rm -f /etc/udev/rules.d/70-persistent-net.rules
- open VMWare Virtual machine Services

see VMWare Whether the network adapter in the lower right corner is connected , If there is no connection, connect
Restart the solution
If none of the above is solved , There's one last move -- restart See if there are miracles ![email protected]$%^&*
- No matter what
- Use NAT Pattern
- Change to dynamic acquisition first ip Address
- View the current DNS
cat /etc/resolv.conf- Change to static ip
- After updating the required software, you can change back to the bridge mode again
install JDK1.8
download JDK
https://www.oracle.com/java/technologies/javase/javase-jdk8-downloads.html

Upload to centos

Will local jdk-8u281-linux-x64.tar.gz Upload to /usr Next , Rename it to java1.8, If the local directory is switched to d:/tmp1
sftp>lcd d:/tmp1
centos Change directory to /usr
sftp>cd /usr
Check the local directory
sftp> lpwd
d:/tmp
see centos Catalog
sftp> pwd
/usr
Upload
sftp> put jdk-8u281-linux-x64.tar.gz
rename
sftp> mv jdk-8u281-linux-x64.tar.gz java1.8
decompression JDK
Enter command cd /usr Come to the copy file just now , Enter command tar -zxvf java1.8 unpack , Extract a folder jdk1.8.0_281, Go to this folder 
Configure environment variables
Enter command vi /etc/profile Modify the configuration file , Remember to be in root Modify under authority , Input i Enter editing status , Then move the cursor to the last line , Paste the following , want Set according to your own decompression directory

Click on esc Enter command mode , Input :wq Save modification information ; Then type the command source /etc/profile Make profile effective .
test
Enter command java -version see .

install MySQL5.7
install wget
yum -y install wget
download rpm package
sudo wget http://repo.mysql.com/yum/mysql-5.7-community/el/7/x86_64/mysql57-community-release-el7-10.noarch.rpm
sudo rpm -ivh mysql57-community-release-el7-10.noarch.rpm
install mysql
sudo yum -y install mysql-community-server
start-up mysql
sudo systemctl start mysqld
Set boot up
sudo systemctl enable mysqld
Find the initial password
stay /var/log/mysqld.log Found in file Initial password
cat /var/log/mysqld.log

land mysql
sudo mysql -uroot -p
Enter the above initial password
Change Password
ALTER USER 'root'@'localhost' IDENTIFIED BY '1qaz!QAZ';
The default rule of password strength is : Minimum length 8 position , Contains upper and lower case letters 、 Numbers 、 Special characters
Set up remote login
- Execute the authorization order
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '1qaz!QAZ' WITH GRANT OPTION;
exit sign out mysql Operation console
- to open up 3306 port
Turn on the firewall
sudo systemctl start firewalld.service
Permanent opening 3306 port
sudo firewall-cmd --add-port=3306/tcp --permanent
Reload
sudo firewall-cmd --reload
Turn off firewall
sudo systemctl stop firewalld.service
Set default encoding
- View before modification mysql code

- modify
/etc/my.cnffile , Add the following two lines
character_set_server=utf8
init_connect='SET NAMES utf8'

- After modification , restart mysql
sudo systemctl restart mysqld
- Look at the modified mysql code

test
Use navicat Connect mysql

datafile location :/var/lib/mysqlTo configurefile location :/etc/my.cnfjournalfile location :/var/log/mysqld.log
The project starts automatically
- Upload jar package
Upload jar Package to /usr/local/project/, A test run
java -jar springboot.jar
- newly added service file
stay /etc/systemd/system/ Below directory , Add a new one to service For the suffix Script file for
cd /etc/systemd/system
vi java.service
The contents of the document are as follows :
[Unit]
Description=java
After=syslog.target
[Service]
Type=simple
ExecStart=/usr/jdk1.8.0_281/bin/java -jar /usr/local/project/springboot.jar
[Install]
WantedBy=multi-user.target
/usr/jdk1.8.0_281by jdk The installation path/usr/local/project/springboot.jarFor packed jar Package file
- Add execute permission
chmod +x /etc/systemd/system/java.service
- Reload service
systemctl daemon-reload
- Start the service and join the startup self startup
systemctl start java
systemctl enable java
ps -ef | grep "java"| grep -v grep
systemctl status java.service -l
install Tomcat8.5
- download tomcat8.5
https://tomcat.apache.org/download-80.cgi

- Upload and unzip
Upload to /usr/, And execute the following command to unzip
tar -zxvf apache-tomcat-8.5.63.tar.gz
- tomcat Add startup parameters
tomcat root directory I need to increase One pid file tomcat.pid
touch tomcat.pid
stay tomcat/bin Below directory , increase setenv.sh To configure ,catalina.sh Called at startup , Simultaneous configuration Java Memory parameters
export CATALINA_HOME=/usr/apache-tomcat-8.5.63
export CATALINA_BASE=/usr/apache-tomcat-8.5.63
#add tomcat pid
CATALINA_PID="$CATALINA_BASE/tomcat.pid"
#add java opts
JAVA_OPTS="-server -XX:PermSize=256M -XX:MaxPermSize=1024m -Xms512M -Xmx1024M -XX:MaxNewSiz
- newly added service file
stay /etc/systemd/system/ Below directory , newly added One by service For the suffix The file of
vi /etc/systemd/system/tomcat.service
The contents of the document are as follows
[Unit]
Description=Tomcat
After=syslog.target network.target remote-fs.target nss-lookup.target
[Service]
Type=forking
Environment="JAVA_HOME=/usr/jdk1.8.0_281"
PIDFile=/usr/apache-tomcat-8.5.63/tomcat.pid
ExecStart=/usr/apache-tomcat-8.5.63/bin/startup.sh
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s QUIT $MAINPID
PrivateTmp=true
[Install]
WantedBy=multi-user.target
- Add execute permission
chmod +x /etc/systemd/system/tomcat.service
- Reload service
systemctl daemon-reload
- Start the service and join the startup self startup
Direct start
systemctl start tomcat
chkconfig mysqld on
systemctl enable tomcat
View startup status
systemctl status tomcat.service
Out of Service
systemctl stop tomcat
Inquire about tomcat process
ps -ef | grep “tomcat”| grep -v grep
If Multiple tomcat, Then copy to a different directory , Use different ports .tomcat.service The file name can be different .
Such as :tomcat1.service tomcat2.service tomcat3.service
- Restart the server
restart , Try to access .
边栏推荐
- If I am in Beijing, where is a better place to open an account? In addition, is it safe to open a mobile account?
- Sampling Area Lights
- 咱就是说 随便整几千个表情包为我所用一下
- Introduction to the core functions of webrtc -- an article to understand peerconnectionfactoryinterface rtcconfiguration peerconnectioninterface
- Lenovo x86 server restart management controller (xclarity controller) or TSM method
- Mouse over effect VI
- Borrowing constructor inheritance and composite inheritance
- 最好用的信任关系自动化脚本(shell)
- 产业互联网中,「小」程序有「大」作为
- Lavaweb [first understanding the solution of subsequent problems]
猜你喜欢

Voici le programme de formation des talents de SHARE Creators!
![[applet project development -- JD mall] uni app commodity classification page (first)](/img/6c/5b92fc1f18d58e0fdf6f1896188fcd.png)
[applet project development -- JD mall] uni app commodity classification page (first)

MCU firmware packaging Script Software

Huawei operator level router configuration example | configuration optionA mode cross domain LDP VPLS example

Restcloud ETL practice to realize incremental data synchronization without identification bit

Network address translation (NAT) technology

# 使用 KubeKey 搭建 Kubernetes/KubeSphere 环境的'心路(累)历程'

The operation efficiency of the park is improved, and the application platform management of applet container technology is accelerated

Lenovo x86 server restart management controller (xclarity controller) or TSM method

咱就是说 随便整几千个表情包为我所用一下
随机推荐
Example of Huawei operator level router configuration | example of configuring optionc mode cross domain LDP VPLS
Mouse over effect V
Record a service deployment failure troubleshooting
实战 ELK 优雅管理服务器日志
Summary of problems encountered in debugging positioning and navigation
Catch 222222
产业互联网中,「小」程序有「大」作为
安装VCenter6.7【VCSA6.7(vCenter Server Appliance 6.7) 】
Mouse over effect 9
Const and the secret of pointers
Introduction to webrtc concept -- an article on understanding source, track, sink and mediastream
鼠标悬停效果六
Huawei operator level router configuration example | configuration static VPLS example
【小程序项目开发-- 京东商城】uni-app之首页商品楼层
【PR #5 A】双向奔赴(状压DP)
Share Creators萌芽人才培養計劃來了!
Poj-3486-computers[dynamic planning]
彻底解决Lost connection to MySQL server at ‘reading initial communication packet
Cloud native annual technology inventory is released! Ride the wind and waves at the right time
【Qt】添加第三方库的知识补充