到底怎么添加环境变量???????
Tofloor
poster avatar
ritter
deepin
2017-09-16 18:45
Author
我修改了/etc/profile, 每次都要source一下才有用,修改了etc/environment, 现在直接系统都进不去了。。。。。。。。这个bug怎么解决?
Reply Favorite View the author
All Replies
avatar
billy123456
deepin
2017-09-16 19:14
#1
这不是bug,是你改错地方了
Reply View the author
avatar
许自强
deepin
2017-09-16 19:17
#2
可以进入live模式把文件改回来
Reply View the author
avatar
152******09
deepin
2017-09-16 19:23
#3
开机 按e键 进入 单用户模式 ,然后进行修改 进入 单用户 模式,具体可以参考
http://jingyan.baidu.com/article/ed15cb1bb26b461be3698135.html
Reply View the author
avatar
Lyvnee
deepin
2017-09-16 22:22
#4
Reply View the author
avatar
ritter
deepin
2017-09-17 01:42
#5
https://bbs.deepin.org/post/145604
这不是bug,是你改错地方了

已经解决了,需要重启才行。不过etc/environment确实没鸟用,改了都进不了桌面,跟mint有点不一样。
Reply View the author
avatar
ritter
deepin
2017-09-17 01:45
#6
https://bbs.deepin.org/post/145604
可以进入live模式把文件改回来

ctrl+alt+F2进入字符界面改了回来,就是etc/environment的问题,在ubuntu和mint上面可以通过修改etc/environment来永久添加环境变量,在deepin不行。
Reply View the author
avatar
ritter
deepin
2017-09-17 01:46
#7
https://bbs.deepin.org/post/145604
https://bbs.deepin.org/post/144449

谢谢!(手动添加到10个字符)
Reply View the author
avatar
grid
deepin
2017-09-17 02:11
#8
我改的是/etc/profile
Reply View the author
avatar
许自强
deepin
2017-09-17 03:25
#9
https://bbs.deepin.org/post/145604
ctrl+alt+F2进入字符界面改了回来,就是etc/environment的问题,在ubuntu和mint上面可以通过修改etc/envi ...

修改.bashrc可以实现吗
Reply View the author
avatar
ritter
deepin
2017-09-17 07:27
#10
https://bbs.deepin.org/post/145604
修改.bashrc可以实现吗

不确定,我最后还是修改了profile,然后重启一下,environment千万不要去碰,估计就是bug。
Reply View the author
avatar
ritter
deepin
2017-09-17 07:28
#11
https://bbs.deepin.org/post/145604
我改的是/etc/profile

没错,这个可以,就是得重启一下。
Reply View the author
avatar
Lyvnee
deepin
2017-09-17 07:58
#12
ritter 发表于 2017-9-16 23:28
没错,这个可以,就是得重启一下。

source /etc/profile  应该就立即生效了
Reply View the author
avatar
ritter
deepin
2017-09-17 12:36
#13
https://bbs.deepin.org/post/145604
source /etc/profile  应该就立即生效了

确实可以,但是重启一下terminal又没了,必须重启系统才能永久性添加成功。
Reply View the author
avatar
134******40
deepin
2017-09-17 19:56
#14
可以使用新的管理方式,不一定非要使用/etc/profile文件管理。看见/etc/profile.d文件夹了不,这就是新的管理方式。现在网上的资料太老了,你抄我抄大家抄,都不知道更新一下。
以jdk.sh为例:

  1. export J2SDKDIR=/usr/lib/jvm/java-8-oracle
  2. export J2REDIR=/usr/lib/jvm/java-8-oracle/jre
  3. export PATH=$PATH:/usr/lib/jvm/java-8-oracle/bin:/usr/lib/jvm/java-8-oracle/db/bin:/usr/lib/jvm/java-8-oracle/jre/bin
  4. export JAVA_HOME=/usr/lib/jvm/java-8-oracle
  5. export DERBY_HOME=/usr/lib/jvm/java-8-oracle/db
Copy the Code

你可以复制一份jdk.sh以此为基础修改环境变量。
Reply View the author
avatar
firedrake
deepin
2017-09-17 20:03
#15
/etc/environment就是简单的一行一个key=value
Reply View the author
avatar
ritter
deepin
2017-09-18 09:24
#16
https://bbs.deepin.org/post/145604
/etc/environment就是简单的一行一个key=value

PATH="/../../..:/../../..:/../.."
你是指这个?在Ubuntu和mint确实可以,但是在deepin不行,改了桌面都进不去。。。。
Reply View the author
avatar
justforlxz
deepin
2017-09-18 16:57
#17
https://bbs.deepin.org/post/145604
PATH="/../../..:/../../..:/../.."
你是指这个?在Ubuntu和mint确实可以,但是在deepin不行,改了桌面都 ...

如果你只是单用户,那就修改~/.xprofile  或者 ~/.pam_environment.这样不妨碍你正常开机,就算出问题,也不会影响系统和root,还是可以切tty去改的。

格式如下:
$ cat ~/.pam_environment
LANG=zh_CN.UTF-8
LANGUAGE=zh_CN%                                                                                                                    

$ cat ~/.xprofile      
export GOPATH=$HOME/projects/Go
export PATH=$PATHGOPATH/bin
Reply View the author
avatar
ritter
deepin
2017-09-19 16:46
#18
https://bbs.deepin.org/post/145604
如果你只是单用户,那就修改~/.xprofile  或者 ~/.pam_environment.这样不妨碍你正常开机,就算出问题, ...

好的,谢谢。
Reply View the author