Original URL: http://blog.chinaunix.net/uid-26963688-id-3221439.html
1. Set the current user environment variable (invalid for root user)
Open Terminal input:
[Email protected]:~$ sudo gedit ~/.BASHRC
[sudo] password for light:
Add at the end:
Export Path=/opt/embedsky/4.3.3/bin: $PATH
, where/opt/embedsky/4.3.3/bin is the path to the environment variable you need to set.
To make it effective immediately, execute at the terminal:
[Email protected]:~$ Source ~/.BASHRC
or restart your computer.
2. Setting the system environment variable (for root user)
Open Terminal input:
[Email protected]:~$ sudo gedit/etc/environment
[sudo] password for light:
Add "colon:" plus "your environment variable path" at the end of Path= "...."
To make it effective immediately, execute at the terminal:
[Email protected]:~$ source/etc/environment
or restart your computer.
--------------------------------------------------------------------------------------------
For example:
[email protected]: ~# arm-linux-gcc-v
Using built-in specs.
Target:arm-none-linux-gnueabi
Configured with:/scratch/julian/lite-respin/linux/src/gcc-4.3/configure--build=i686-pc-linux-gnu--host= I686-pc-linux-gnu--target=arm-none-linux-gnueabi--enable-threads--disable-libmudflap--DISABLE-LIBSSP-- disable-libstdcxx-pch--with-gnu-as--with-gnu-ld--enable-languages=c,c++--enable-shared--enable-symvers=gnu-- Enable-__cxa_atexit--with-pkgversion= ' sourcery g++ Lite 2008q3-72 '--with-bugurl=https://support.codesourcery.com/ gnutoolchain/--disable-nls--prefix=/opt/codesourcery--with-sysroot=/opt/codesourcery/arm-none-linux-gnueabi/ LIBC--WITH-BUILD-SYSROOT=/SCRATCH/JULIAN/LITE-RESPIN/LINUX/INSTALL/ARM-NONE-LINUX-GNUEABI/LIBC--with-gmp=/ SCRATCH/JULIAN/LITE-RESPIN/LINUX/OBJ/HOST-LIBS-2008Q3-72-ARM-NONE-LINUX-GNUEABI-I686-PC-LINUX-GNU/USR-- with-mpfr=/scratch/julian/lite-respin/linux/obj/host-libs-2008q3-72-arm-none-linux-gnueabi-i686-pc-linux-gnu/ usr--disable-libgomp--enable-poison-system-directories--with-build-time-tools=/scratch/julian/lite-respin/ Linux/install/arm-none-linux-gnueabi/bin--with-build-time-tools=/scratch/julian/lite-respin/linux/install/ Arm-none-linux-gnueabi/bin
Thread Model:posix
GCC version 4.3.2 (sourcery g++ Lite 2008q3-72)
[email protected]:~#------------------------------------------------------------------------------------------- [email protected]: ~# vim/etc/environmentshown below:#PATH = "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/arm/4.3.2/bin"
Path= "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/work/tools/ Gcc-3.4.5-glibc-2.3.6/bin "
~
~
~
"/etc/environment" 2L, 222C all-------------------------------------------------------------------------------------------
"Turn" Ubuntu12.04 LTS environment variable setting