Basic Linux instructions
-
Delete the rm xx. The text
-
Delete folder rm -rf dist -r recursive delete, delete subfiles -f forcible delete
-
Find /home -name ‘xx’
-
Find / -name ‘XXX’
-
Copy cp /usr/local/text /root/newtest
-
Echo output
echo > text
Copy text contentecho >> text
text
The text is appended
-
Port query netstat NTPL | grep SSHD
-
Query service port netstat -atulnp will show all ports and all corresponding programs, using grep pipe to filter out the desired fields
Example Change the default SSH port
Vim /etc/ssh/sshd_config Delete the comment 22. Add a new Port Port 4365 Restart the SSHD service test Whether the connection is normal Test No problem Comment out Port 22 (security)
SSH SSH -p 2345 [email protected]
Docker deployment is relevant
Docker RMI imagesId Delete container
Docker log operations
docker logs -f CONTAINER_ID
Viewing Logs in Real Timedocker logs -t since CONTAINER_ID
Example Query the logs at a specified time
docker logs -t --since="2018-02-08T13:23:37" --until "2018-02-09T12:23:37" CONTAINER_ID
Copy the code
Docker deployment JAR project
- Package the project into a JAR package and upload it to the server
- Add the following content to the common Dockerfile file in the jar directory
FROM java:8
MAINTAINER xiongchao
ADD the demo - 0.0.1 - the SNAPSHOT. Jar demo. The jar
EXPOSE 8080
ENTRYPOINT ["java"."-jar"."demo.jar"]
Copy the code
Demo - 0.0.1 - the SNAPSHOT. Jar demo. The jar
addjar
Package and alias asdemo.jar
- What is the number of the ‘EXPOSE 8080’ port
Docker deployment Vue project steps
- The project is packaged into a DIST file
- Common Dockerfile files in the same directory are as follows
Step 1 has installed the latest version of nginx
FROOM nginx
# define author name
MAINTAINER xiongchao
Copy the dist folder to /usr/share/nginx/html/
COPY dist/ /usr/share/nginx/html/
Copy the code
- will
dist
Files andDockerfile
The files are packaged together and uploaded to the server - Unzip the files
Unzip dits.zip ' 'decompresses to current folder by default 5. Docker build-t vueApp.
Build the mirror.
Indicates that the current folder is usedDockerfile
file - Run the mirror
docker run -p 80:80 -d --name voice_vue voice_vue
Docker enables external access ports
Modify the paths of files vim/usr/lib/systemd/system/docker. Service
ExecStart = / usr/bin/dockerd -h TCP: / / 0.0.0.0:2375 - H Unix: / / var/run/docker. The sock \
Copy the code
Vim edit sets the color and line number
Colorscheme desert # save exit :wq # query /keywords # force exit :q!Copy the code
Linux tests whether the url is valid
curl -V "http://ip+port" wget ip:port curl ip:port telnet ip:port Copy the code
Run jar package javaw-jar xxxx.jar in Windows
nohup java -jar -Xms1g -Xmx1g xxxx.jar –spring.profiles.active=test 2>&1 &
The disk check
- Check disk usage
df -h
- Analyze the disk memory usage
du -sh /*
Memory Usage check - The memory view
free -h
JDK and MVN environment variable configuration
- Configure global environment variables
/etc/profile
exportJAVA_HOME = / usr/Java/jdk1.8.0 _121
export JRE_HOME=$JAVA_HOME/jre
export CLASSPATH=$CLASSPATH:$JAVA_HOME/lib:$JAVA_HOME/jre/lib
PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin
exportM2_HOME = / usr/xc/apache maven -- 3.6.3
export PATH=$PATH:$M2_HOME/bin
Copy the code
-
Checking and taking effect of the profile source /etc/profile The configuration takes effect permanently
-
Export CLASSPATH=$CLASSPATH:$JAVA_HOME/lib:$JAVA_HOME/jre/lib The file used by this command is ~/. Bashrc, which is valid only for the currently opened window
Give all permissions to the new database user
GRANT ALL PRIVILEGES ON *.* TO "Xiongchao "@"%" IDENTIFIED BY" Xiongchao "WITH GRANT OPTION; # Yes Set to effect Flush PRIVILEGESCopy the code
Pagoda installation
# One-click install
yum install -y wget; Wget - O the sh http://download.bt.cn/install/install_6.0.sh && sh the sh
# start | stop | restart
/etc/init.d/bt start|restart|stop|default
# Forget password reset password
cd /www/server/panel python tools.py panel newpassword
Copy the code
A firewall
systemctl status firewalld
System IP Address View ifconfig
Redis installation
- download
Wget HTTP: / / http://download.redis.io/releases/redis-4.0.6.tar.gz
Version specified - Unpack the
The tar - ZXVF redis - 4.0.6. Tar. Gz
- The installation
CD redis - 4.0.6 make
- Back up and modify configuration files
cp redis.config redis.config.bak
- Modify configuration file background running
daemonize yes
- Start the
CD. SRC/redis server/usr/local/redis - 4.0.6 / redis. Config
- Shut down
ps -aux | grep redis
- Setting boot
1. cp /usr/local/ redis - 4.0.6 / utils/redis_init_script/etc/init. D/redisd
2. Vim /etc/init.d/redisd is added in the second line
# chkconfig: 2345 90 10
# description: Redis is a persistent key-value database
3. Grant the permission chmod a+x redisd
4. Run chkconfig redisd to set the parameters
5. Run the service redisd start/stop/restart command to copy the specified redis-server file and redis-cli file to the corresponding location according to the error log or directly modify the configuration file
Copy the code
Multithreaded download tool Axel
- download
yum install axel
-n
The flag specifies five thread downloads
axel -n 5 http://......
Download and install Zookeeper
Zookeeper domestic image download address http://mirrors.hust.edu.cn/apache/zookeeper/
The problem record
Start the error Can’t find or unable to load the main class org. Apache. Zookeeper. Server. Quorum. QuorumPeerMain download package mistake You need to download the tar with bin address package
FTP Instructions
- Use FTP
- FTP 127.0.0.1 16912 yunwei
- ls
- cd .. /xinta
- ll
- get dist-1012.zip
- exit
- unzip dist-1012.
File transfer between servers
To the remote server file copy to local/usr/local SCP -p 4365 114.55.164.189: under/usr/local/redis – 4. Zip/usr/local /
Time synchronization
Yum -y install NTP ntpDate Synchronizes network time ntpDate cn.pool.ntp.org
Run the cat cat start.sh command to view the file
Linux file upload and download
yum install lrzsz
Node Installation and Download
- access
node
https://nodejs.org/en/download/ website ` ` ` - Find the specified system and version by command download
Wget HTTP: / / https://nodejs.org/dist/v14.15.4/node-v14.15.4-linux-x64.tar.xz
- Unpack the
The tar - vf node - v14.15.4 - Linux - x64. Tar. Xz
- rename
Node - mv v14.15.4 - Linux - x64 node
- test
node
service./node -v
- Create a soft connection
ln -s /opt/node/bin/node /usr/local/bin/node
ln -s /opt/node/bin/npm /usr/local/bin/npm
ln -s /opt/node/bin/npm /usr/local/bin/npx
Copy the code
- The global inspection
node -v ; npm -v