当前位置:网站首页>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 .
边栏推荐
- Restcloud ETL WebService data synchronization to local
- Lenovo x86 server restart management controller (xclarity controller) or TSM method
- Gartner research: in China, the adoption of hybrid cloud has become the mainstream trend
- 最新接口自动化面试题
- 使用ipmitool配置X86服务器的BMC网络和用户信息
- Od modify DLL and exe pop-up contents [OllyDbg]
- Add / delete / modify query summary insert/create/put/add/save/post, delete/drop/remove, update/modify/change, select/get/list/find
- 实战 ELK 优雅管理服务器日志
- 【Qt】添加第三方库的知识补充
- Saving images of different depths in opencv
猜你喜欢
![[QT] add knowledge supplement of third-party database](/img/ea/ca8b07ad80485208f2bb8ee8a78a28.png)
[QT] add knowledge supplement of third-party database
![[machine learning] vectorized computing -- a must on the way of machine learning](/img/3f/d672bb254f845ea705b3a0ca10ee19.png)
[machine learning] vectorized computing -- a must on the way of machine learning

【Qt】添加第三方库的知识补充
![[exsi] transfer files between hosts](/img/c3/128b72aca6e030b2d4be2b6bddbc43.png)
[exsi] transfer files between hosts

Gartner research: in China, the adoption of hybrid cloud has become the mainstream trend
![[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)

Prototype and prototype chain in JS

Sampling Area Lights

通信协议——分类及其特征介绍

Huawei operator level router configuration example | configuration optionA mode cross domain LDP VPLS example
随机推荐
Network address translation (NAT) technology
实战 ELK 优雅管理服务器日志
Mouse over effect 7
彻底解决Lost connection to MySQL server at ‘reading initial communication packet
ssh配置免密登录时报错:/usr/bin/ssh-copy-id: ERROR: No identities found 解决方法
PTA 1016
Introduction to the core functions of webrtc -- an article to understand peerconnectionfactoryinterface rtcconfiguration peerconnectioninterface
servlet【初识】
MySQL index --01--- design principle of index
[wechat applet development] style summary
Nacos configuration center tutorial
PTA 1017
IEDA 右键源码文件菜单简介
Borrowing constructor inheritance and composite inheritance
使用ipmitool配置X86服务器的BMC网络和用户信息
[machine learning] vectorized computing -- a must on the way of machine learning
Contrastive learning of Class-agnostic Activation Map for Weakly Supervised Object Localization and
记一次服务部署失败问题排查
Optimal transport Series 1
Redis分布式锁的8大坑