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 > textCopy text content
    • echo >> text textThe 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_IDViewing Logs in Real Time
  • docker logs -t since CONTAINER_IDExample 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

  1. Package the project into a JAR package and upload it to the server
  2. 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 jaraddjarPackage and alias asdemo.jar
  • What is the number of the ‘EXPOSE 8080’ port

Docker deployment Vue project steps

  1. The project is packaged into a DIST file
  2. 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
  1. willdistFiles andDockerfileThe files are packaged together and uploaded to the server
  2. Unzip the filesUnzip dits.zip ' 'decompresses to current folder by default 5. Docker build-t vueApp.Build the mirror.Indicates that the current folder is usedDockerfilefile
  3. Run the mirrordocker 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

  1. Check disk usagedf -h
  2. Analyze the disk memory usagedu -sh /*Memory Usage check
  3. The memory viewfree -h

JDK and MVN environment variable configuration

  1. 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
  1. Checking and taking effect of the profile source /etc/profile The configuration takes effect permanently

  2. 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

  1. downloadWget HTTP: / / http://download.redis.io/releases/redis-4.0.6.tar.gzVersion specified
  2. Unpack theThe tar - ZXVF redis - 4.0.6. Tar. Gz
  3. The installationCD redis - 4.0.6 make
  4. Back up and modify configuration filescp redis.config redis.config.bak
  5. Modify configuration file background runningdaemonize yes
  6. Start theCD. SRC/redis server/usr/local/redis - 4.0.6 / redis. Config
  7. Shut downps -aux | grep redis
  8. 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

  1. downloadyum install axel
  2. -nThe 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

  1. Use FTP
  2. FTP 127.0.0.1 16912 yunwei
  3. ls
  4. cd .. /xinta
  5. ll
  6. get dist-1012.zip
  7. exit
  8. 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

  1. accessnodehttps://nodejs.org/en/download/ website ` ` `
  2. Find the specified system and version by command downloadWget HTTP: / / https://nodejs.org/dist/v14.15.4/node-v14.15.4-linux-x64.tar.xz
  3. Unpack theThe tar - vf node - v14.15.4 - Linux - x64. Tar. Xz
  4. renameNode - mv v14.15.4 - Linux - x64 node
  5. testnodeservice./node -v
  6. 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
  1. The global inspectionnode -v ; npm -v