安裝vim
java
[root@localhost java]# rpm -qa|grep vim vim-minimal-7.4.629-6.el7.x86_64 [root@localhost java]# yum -y install vim* ...
使用FileZilla
上傳jdk
到Linux系統的/home/software
linux
[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/ ...
配置java環境變量c++
[root@localhost java]# vim /etc/profile ... #最下方添加下面三條 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)
FileZilla
上傳redis
到Linux系統的/home/software
解壓壓縮包redis
[root@localhost software]# tar -zxvf redis-5.0.7.tar.gz
由於須要編譯和生成redis,所以須要安裝gcc
shell
[root@localhost software]# yum -y install gcc-c++ ... 已安裝: gcc-c++.x86_64 0:4.8.5-39.el7 做爲依賴被安裝: 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 完畢!
進入redis-5.0.7
解壓目錄,執行安裝:vim
[root@localhost redis-5.0.7]# make && make install
配置Redisbash
[root@localhost utils]# ll 總用量 52 -rw-rw-r--. 1 root root 593 11月 20 01:05 build-static-symbols.tcl -rw-rw-r--. 1 root root 1303 11月 20 01:05 cluster_fail_time.tcl -rw-rw-r--. 1 root root 1098 11月 20 01:05 corrupt_rdb.c drwxrwxr-x. 2 root root 60 11月 20 01:05 create-cluster -rwxrwxr-x. 1 root root 2149 11月 20 01:05 generate-command-help.rb drwxrwxr-x. 3 root root 31 11月 20 01:05 graphs drwxrwxr-x. 2 root root 39 11月 20 01:05 hashtable drwxrwxr-x. 2 root root 70 11月 20 01:05 hyperloglog -rwxrwxr-x. 1 root root 9567 11月 20 01:05 install_server.sh drwxrwxr-x. 2 root root 63 11月 20 01:05 lru -rw-rw-r--. 1 root root 1277 11月 20 01:05 redis-copy.rb -rwxrwxr-x. 1 root root 1352 11月 20 01:05 redis_init_script -rwxrwxr-x. 1 root root 1047 11月 20 01:05 redis_init_script.tpl -rw-rw-r--. 1 root root 1762 11月 20 01:05 redis-sha1.rb drwxrwxr-x. 2 root root 135 11月 20 01:05 releasetools -rwxrwxr-x. 1 root root 3787 11月 20 01:05 speed-regression.tcl -rwxrwxr-x. 1 root root 693 11月 20 01:05 whatisdoing.sh
如上所示,在utils
目錄下,有一個redis_init_script
文件,複製該文件到/etc/init.d/
目錄下,目的是爲了配置redis爲開機自啓動。網絡
[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/
建立/usr/local/redis
目錄,用於存放redis配置文件。tcp
修改redis配置文件ide
################################# GENERAL ##################################### # 修改daemonize no爲yes,目的是啓動redis之後臺進程運行 daemonize yes # 修改redis工做路徑(數據存儲位置) dir /usr/local/redis/workingdb # 表明能夠被遠程訪問,不受ip限制 #bind 127.0.0.1 bind 0.0.0.0 # 修改密碼 requirepass 12345678
修改redis_init_script
文件中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" [root@localhost init.d]# chmod 777 redis_init_script #啓動redis [root@localhost init.d]# ./redis_init_script start
設置開機自啓動
/etc/init.d
路徑下的啓動腳本文件中添加#chkconfig: 22345 10 90
&#description: Start and Stop redis
[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"
chkconfig redis_init_script on
,啓動配置.關閉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 # 在腳本中也須要添加密碼驗證,才能關閉redis 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 ;; *)
安裝以後,遠程鏈接失敗,由於在CentOS7 默認開啓防火牆
# 中止防火牆 [root@localhost ~]# systemctl stop firewalld.service # 禁止防火牆開機啓動 [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.
或者執行下述命令來開放6379端口
firewall-cmd --zone=public --add-port=6379/tcp --permanent
直接在VM ware fusion中須要克隆的機器上右鍵,選擇 建立完整克隆
CentOS 7.直接修改Ip
vim /etc/sysconfig/network-scripts/ifcfg-ens33 # 修改IP配置 service network restart 重置網絡
CentOS 6或某些版本,須要更改MAC地址和IP
vim /etc/udev/rule.d/70-persistent-ipoib.rules vim /etc/sysconfig/network-scripts/ifcfg-ens33 # 修改IP配置 service network restart 重置網絡
本身在 ~/.bash_profile 中配置環境變量, 但是每次重啓終端後配置的不生效.須要從新執行 : $source ~/.bash_profile
發現zsh加載的是 ~/.zshrc文件,而 ‘.zshrc’ 文件中並無定義任務環境變量。
解決辦法
在~/.zshrc文件最後,增長一行:source ~/.bash_profile