Install CentOS7 Virtual Machine using ISO
-
Configure static IP (Reference Mac VMware Fusion CentOS7 Configuration Static IP)
-
Install vim
[root@localhost java]# rpm -qa|grep vim vim-minimal-7.4.629-6.el7.x86_64 [root@localhost java]# yum -y install vim* ...
Install jdk
- Upload jdk to / home/software on Linux using FileZilla
[root@localhost software]# mkdir /usr/java ... [root@localhost software]# mkdir /home/software ... [root@localhost software]# tar -zxvf jdk-8u231-linux-x64.tar.gz ... [root@localhost software]# mv jdk1.8.0_231 /usr/java/ ...
- Configuring java environment variables
[root@localhost java]# vim /etc/profile ... #Add the following three items at the bottom export JAVA_HOME=/usr/java/jdk1.8.0_231 export CLASSPATH=.:%JAVA_HOME%/lib/dt.jar:%JAVA_HOME%/lib/tools.jar export PATH=$PATH:$JAVA_HOME/bin ... [root@localhost java]# source /etc/profile [root@localhost java]# java -version java version "1.8.0_231" Java(TM) SE Runtime Environment (build 1.8.0_231-b11) Java HotSpot(TM) 64-Bit Server VM (build 25.231-b11, mixed mode)
Install Redis
-
https://redis.io/download Download a stable version
-
Upload redis to/home/software on Linux using FileZilla
-
Decompression package
[root@localhost software]# tar -zxvf redis-5.0.7.tar.gz
gcc needs to be installed because redis need to be compiled and generated
[root@localhost software]# yum -y install gcc-c++ ... //Installed: gcc-c++.x86_64 0:4.8.5-39.el7 //Installed as a dependency: cpp.x86_64 0:4.8.5-39.el7 gcc.x86_64 0:4.8.5-39.el7 glibc-devel.x86_64 0:2.17-292.el7 glibc-headers.x86_64 0:2.17-292.el7 kernel-headers.x86_64 0:3.10.0-1062.9.1.el7 libmpc.x86_64 0:1.0.1-3.el7 libstdc++-devel.x86_64 0:4.8.5-39.el7 mpfr.x86_64 0:3.1.1-4.el7 //Complete!
Enter the redis-5.0.7 unzip directory to perform the installation:
[root@localhost redis-5.0.7]# make && make install
-
Configure Redis
[root@localhost utils]# ll //Total usage 52 -rw-rw-r--. 1 root root 593 11 February 2001:05 build-static-symbols.tcl -rw-rw-r--. 1 root root 1303 11 February 2001:05 cluster_fail_time.tcl -rw-rw-r--. 1 root root 1098 11 February 2001:05 corrupt_rdb.c drwxrwxr-x. 2 root root 60 11 February 2001:05 create-cluster -rwxrwxr-x. 1 root root 2149 11 February 2001:05 generate-command-help.rb drwxrwxr-x. 3 root root 31 11 February 2001:05 graphs drwxrwxr-x. 2 root root 39 11 February 2001:05 hashtable drwxrwxr-x. 2 root root 70 11 February 2001:05 hyperloglog -rwxrwxr-x. 1 root root 9567 11 February 2001:05 install_server.sh drwxrwxr-x. 2 root root 63 11 February 2001:05 lru -rw-rw-r--. 1 root root 1277 11 February 2001:05 redis-copy.rb -rwxrwxr-x. 1 root root 1352 11 February 2001:05 redis_init_script -rwxrwxr-x. 1 root root 1047 11 February 2001:05 redis_init_script.tpl -rw-rw-r--. 1 root root 1762 11 February 2001:05 redis-sha1.rb drwxrwxr-x. 2 root root 135 11 February 2001:05 releasetools -rwxrwxr-x. 1 root root 3787 11 February 2001:05 speed-regression.tcl -rwxrwxr-x. 1 root root 693 11 February 2001:05 whatisdoing.sh
As shown above, in the utils directory, there is a redis_init_script file, which is copied to the / etc/init.d/ directory for the purpose of configuring redis to start automatically.
[root@localhost utils]# cp redis_init_script /etc/init.d/ [root@localhost utils]# mkdir /usr/local/redis -p [root@localhost redis-5.0.7]# cp redis.conf /usr/local/redis/
Create/usr/local/redis directory to store redis configuration files.
-
Modify redis profile
################################# GENERAL ##################################### # Modify daemonize no to yes to start redis for background processes daemonize yes # Modify redis working path (data store location) dir /usr/local/redis/workingdb # Representatives can be accessed remotely without ip restrictions #bind 127.0.0.1 bind 0.0.0.0 # Change Password requirepass 12345678
-
Modify redis core configuration and file permissions in redis_init_script file
REDISPORT=6379 EXEC=/usr/local/bin/redis-server CLIEXEC=/usr/local/bin/redis-cli PIDFILE=/var/run/redis_${REDISPORT}.pid CONF="/usr/local/redis/redis.conf" [root@localhost init.d]# chmod 777 redis_init_script #Start redis [root@localhost init.d]# ./redis_init_script start
-
Set boot-up self-start
- Add #chkconfig: 22345 10 90 &#description: Start and Stop redis to the startup script file under the /etc/init.d path
[root@iZ2ze7s2v0b78922wia32rZ init.d]# vim redis_init_script #!/bin/sh # # Simple Redis init.d script conceived to work on Linux systems # as it does use of the /proc filesystem. ### BEGIN INIT INFO # Provides: redis_6379 # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Redis data structure server # Description: Redis data structure server. See https://redis.io ### END INIT INFO #chkconfig: 22345 10 90 #description: Start and Stop redis REDISPORT=6379 EXEC=/usr/local/bin/redis-server CLIEXEC=/usr/local/bin/redis-cli PIDFILE=/var/run/redis_${REDISPORT}.pid CONF="/usr/local/redis/redis.conf"
-
Execute chkconfig redis_init_script on and start the configuration.
-
Turn off redis
[root@localhost redis]# /etc/init.d/redis_init_script stop Stopping ... (error) NOAUTH Authentication required. Waiting for Redis to shutdown ... Waiting for Redis to shutdown ... [root@localhost redis]# vim /etc/init.d/redis_init_script # Password validation is also required in the script to turn redis off stop) if [ ! -f $PIDFILE ] then echo "$PIDFILE does not exist, process is not running" else PID=$(cat $PIDFILE) echo "Stopping ..." $CLIEXEC -a "12345678" -p $REDISPORT shutdown while [ -x /proc/${PID} ] do echo "Waiting for Redis to shutdown ..." sleep 1 done echo "Redis stopped" fi ;; *)
-
After installation, the remote connection failed because the firewall is turned on by default in CentOS7
# Stop Firewall [root@localhost ~]# systemctl stop firewalld.service # Prevent firewall from starting [root@localhost ~]# systemctl disable firewalld.service Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service. Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
Or execute the following command to open port 6379
firewall-cmd --zone=public --add-port=6379/tcp --permanent
Full Cloning Virtual Machine
-
Right-click directly on the machine you want to clone in VM ware fusion and select Create Full Clone
-
CentOS 7. Modify Ip directly
vim /etc/sysconfig/network-scripts/ifcfg-ens33 # Modify IP Configuration service network restart reset network
-
CentOS 6 or some versions, need to change MAC address and IP
vim /etc/udev/rule.d/70-persistent-ipoib.rules vim /etc/sysconfig/network-scripts/ifcfg-ens33 # Modify IP Configuration service network restart reset network
-
Configuration environment variable failure under Mac
I configure environment variables in ~/.bash_profile myself, but the configuration does not work after each terminal restart. Need to be re-executed: $source ~/.bash_profile
It was found that zsh loaded the ~/.zshrc file, while the'.zshrc'file did not define task environment variables.
Solution
At the end of the ~/.zshrc file, add a line: source ~/.bash_profile
Running Life | Blog Park | segmentfault | spring4all | csdn | Nuggets | OSChina | Short Book | Headlines | Know | 51CTO</https:>