Common operations of Linux in Alibaba Cloud server cluster environment

  •  Install RZ/RS command and its usage instructions under Linux

Compile and install
After logging in with the root account, execute the following commands in sequence:
cd /tmp
wget http://www.ohse.de/uwe/releases/lrzsz-0.12.20.tar.gz
tar zxvf lrzsz-0.12.20.tar.gz && cd lrzsz-0.12.20
./configure && make && make install
The above installation process installs lsz and lrz to the /usr/local/bin/ directory by default, and now we can’t use it directly, create a soft link below and name it rz/sz:
cd /usr/bin
ln -s /usr/local/bin/lrz rz
ln -s /usr/local/bin/lsz sz

 

  •  Modify hostname

- permanent modification

Modification 1: vim /etc/sysconfig/network add hostname hostname

  

Many versions of the Internet say that you can modify one of them. After many tests, I can only modify both of them to succeed;

Restart the server after modification, the host name is displayed

- Temporary modification

Command line input hostname hostname

 

  • Configure password-free communication between servers

Take three machines as master slave01 slave02 as an example

Master machine:

1. Enter the command ssh-keygen -t rsa three carriage returns, one y

After generation, a ".ssh" folder will be generated in the user's root directory, which contains the public key and private key

2. Assign the public key to authorized_keys, if you have this file, you don't need to copy it

The slave01, slave02 servers are also operated as above

3. Send public keys to each other between the three servers to achieve secret-free communication

- ssh-copy-id -i ~/.ssh/id_rsa.pub 192.168.91.135

Send the id of the mater to slave01 and slave02 respectively

Send the id of slave01 to master and slave02 respectively

Send the id of slave02 to master and slave01 respectively

 

  • SCP remote copy

1. Copy the local file or directory to the remote server

 

2. Copy the remote server file or directory to the local machine

 

File copy is the directory structure plus -r, other ordinary files do not need

scp -r /root/software/jdk1.8.0_65 [email protected]:/root/software

 

  • Configure java environment variables

·Open /etc/profile with a text editor 
·Add at the end of the profile file: 
export JAVA_HOME=/root/software/jdk1.8.0_65
export PATH=$JAVA_HOME/bin:$PATH 
export CLASSPATH=.:$JAVA_HOME/lib/dt .jar: $JAVA_HOME/lib/tools.jar 

 

To make the changes just now take effect immediately, you need to execute the following code

# source /etc/profile

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324897356&siteId=291194637