赞
踩
啥是环境变量
环境变量(environment variables)一般是指在操作系统中用来指定操作系统运行环境的一些参数,如:临时文件夹位置和系统文件夹位置等。
环境变量是在操作系统中一个具有特定名字的对象,它包含了一个或者多个应用程序所将使用到的信息。例如Windows和DOS操作系统中的path环境变量,当要求系统运行一个程序而没有告诉它程序所在的完整路径时,系统除了在当前目录下面寻找此程序外,还应到path中指定的路径去找。用户通过设置环境变量,来更好的运行进程。
vim /etc/profile
export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE HISTCONTROL # By default, we want umask to get set. This sets it for login shell # Current threshold for system reserved uid/gids is 200 # You could check uidgid reservation validity in # /usr/share/doc/setup-*/uidgid file if [ $UID -gt 199 ] && [ "`/usr/bin/id -gn`" = "`/usr/bin/id -un`" ]; then umask 002 else umask 022 fi for i in /etc/profile.d/*.sh /etc/profile.d/sh.local ; do if [ -r "$i" ]; then if [ "${-#*i}" != "$-" ]; then . "$i" else . "$i" >/dev/null fi fi done unset i unset -f pathmunge #java environment export JAVA_HOME=/home/vincent/download/jdk1.8.0_221 export CLASSPATH=.:${JAVA_HOME}/jre/lib/rt.jar:${JAVA_HOME}/lib/dt.jar:${JAVA_HOME}/lib/tools.jar #maven export MAVEN_HOME=/usr/local/apache-maven-3.8.6 export MAVEN_HOME #nginx export NGINX_PATH=/usr/local/nginx export PATH=$PATH:${JAVA_HOME}/bin:$PATH:$MAVEN_HOME/bin:$PATH:${NGINX_PATH}/sbin #node NODE_HOME=/usr/local/node/node-v10.0.0-linux-x64 PATH=$PATH:$NODE_HOME/bin NODE_PATH=$NODE_HOME/lib/node_modules #Redis export REDIS_HOME=/usr/local/bin/redis-6.2.6 export PATH=$PATH:${REDIS_HOME}/src "/etc/profile" 95L, 2405C 75,1 底端
source /etc/profile
[root@localhost vincent]# redis-server ./redis.conf #环境变量美没问题 而是redis 配置文件没找到 3613:C 14 Nov 2022 22:17:37.858 # Fatal error, can't open config file '/home/vincent/./redis.conf': No such file or directory [root@localhost vincent]# find / -iname "redis.conf" #Find指令查找Redis.conf find: ‘/run/user/1000/gvfs’: 权限不够 /usr/local/bin/redis-6.2.6/redis.conf /usr/local/src/redis-6.2.6/redis.conf /var/lib/docker/overlay2/6b14fc32176549879b31eefbc59e9ecab76ad03e47a101bc58daa5a506c30b90/diff/etc/redis/redis.conf /var/redis/redis.conf /etc/redis.conf #重新运行Redis服务端 [root@localhost vincent]# redis-server /usr/local/bin/redis-6.2.6/redis.conf #果然
成功了
Find指令怎么用菜鸟教程
https://www.runoob.com/linux/linux-comm-find.html
点击链接
Linux环境变量配置全攻略 - 悠悠i - 博客园
https://www.cnblogs.com/youyoui/p/10680329.html
补充Node和npm测试安装也可以
node -v
npm -v
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。