Centos7 common software installation

No difference in any corner of the world

vim installation

Some versions of centos have already installed vim by default, you can check if there is any before installation.

Query command:

rpm -qa|grep vim

Output result:


If there is no output above, install vim:

yum -y install vim*

After installation, you can add some configurations to make it more beautiful and convenient to use:

vim /etc/vimrc
set nu          // Set display line number
set showmode    // Set to display the current mode at the bottom of the command line interface, etc.
set ruler       // Display information such as the number of lines where the cursor is located in the lower right corner
set autoindent  // Set the cursor to align with the start character of the previous line when the cursor moves to the next line each time the Enter key is clicked
syntax on       // That is, to set syntax detection, when editing C or Shell scripts, keywords will be displayed in special colors

jdk1.8 installation

Check if the system comes with:

java -v

Go to the official website to download the jdk version you need

Use the remote connection tool to put the downloaded compressed package in the /usr directory for decompression

Configure JDK environment variables:

vim /etc/profile

Configure the environment variable, and note that the directory points to your jdk decompression directory

#java environment
export JAVA_HOME=/usr/jdk1.8.0_211
export CLASSPATH=.:${JAVA_HOME}/jre/lib/rt.jar:${JAVA_HOME}/lib/dt.jar:${JAVA_HOME}/lib/tools.jar
export PATH=$PATH:${JAVA_HOME}/bin

Make the configuration file take effect:

source /etc/profile

Test installation results:

 java -version

maven install

The versions of maven on windows and linux are the same, so you can directly throw the maven package you use on windows to linux.

maven-3.6.3-bin.tar.gz download address:

maven official website download

Upload to the /home/work/maven directory


tar -zxvf apache-maven-3.6.3-bin.tar.gz

Configure environment variables:

vim /etc/profile

Add the following content: Pay attention to the directory and version of your maven

export M2_HOME=/home/work/maven/apache-maven-3.3.9
export PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$M2_HOME/bin:$PATH
source /etc/profile


mvn -v

You may encounter insufficient permissions errors when testing:

-bash: /usr/local/maven/apache-maven-3.2.3/bin/mvn: Permission denied

Add permissions:

enter: chmod a+x /opt/apache-maven-3.2.2/bin/mvn

# /opt/apache-maven-3.2.2/bin/mvn is a string of output after you enter mvn-v, modify it according to your own output

wget install

yum -y install wget

redis installation

Check the version you need on the official website

official website

Step by step:

# 1. Enter the directory
cd /usr/local/

# 2. Download
wget https://download.redis.io/releases/redis-6.2.3.tar.gz

# 3. Unzip
tar xzf redis-6.2.3.tar.gz

# 4. Enter the decompression directory
cd redis-6.2.3

# 5. compile

Compilation may appear:

cc: Command not found

That is, less things to compile C

GCC needs to be installed

sudo yum -y install gcc gcc-c++ libstdc++-devel

# Execute after installation
make MALLOC=libc

Modify the configuration file:


Generally, three things are modified:

Modify port: 6379
 Modify login password: requirepass
 You can use the background login daemonize yes

start up

Start in the src directory of redis

/usr/local/redis-6.2.3/src/redis-server /usr/local/redis-6.2.3/redis.conf &

Install Git

sudo yum install -y git

nodejs installation

yum install -y nodejs

Direct installation like this will prompt you "No package available".

First update the epel third-party software library:

yum install -y epel-release
yum install -y nodejs

openssl install

yum install openssl

yum install openssl-devel

Cmake version upgrade

When compiling some C programs, you will be prompted that the Cmake version is too low, that is, you need to upgrade the version.

Download Cmake

Download the latest version cmake-3.22.2.tar.gz here

Then decompress and compile:

cd ~/Downloads/cmake-3.22.2
sudo make install

Test installation results:

cmake -version

Possible problems:

"CMake Error: Could not find CMAKE_ROOT !!!"

input the command:

hash -r

clear cache.

mysql installation

Download and install mysql:

wget https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm

yum -y localinstall mysql57-community-release-el7-11.noarch.rpm

yum -y install mysql-community-server

#There may be an error indicating that the key is insufficient
rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2022

Start the mysql service:

systemctl start mysqld

Set up to start at boot:

systemctl enable mysqld

systemctl daemon-reload

Modify login password:

vim /var/log/mysqld.log
[root@localhost local]# mysql -u root -p
mysql>  ALTER USER 'root'@'localhost' IDENTIFIED BY 'Your password (upper and lower case numeric special characters)';
Query OK, 0 rows affected (0.00 sec)
# Set up remote login
Query OK, 0 rows affected, 1 warning (0.00 sec)

Exit after setting:


Firewall open port 3306:

[root@localhost sysconfig]# cd /etc/sysconfig/
[root@localhost sysconfig]# vim iptables
#Add the code as follows
-A INPUT -p tcp --dport 3306 -j ACCEPT

Restart the firewall:

[root@localhost sysconfig]# service iptables  restart

Configure mysql default encoding to utf-8:

vim /etc/my.cnf

#Add the following code
init_connect='SET NAMES utf8'

Restart MySQL:

systemctl restart mysqld

Tags: Linux Operation & Maintenance server

Posted by sgoldenb on Wed, 01 Feb 2023 22:17:47 +1030