分类: LINUX
2012-12-20 00:47:17
在上一篇文章中,我确认了host的环境,创建了编译系统的硬盘空间,创建文件系统,挂在文件目录到硬盘上,并且把所有需要安装的包放到source文件夹里。
这一篇当中,我们继续来创建接下来的步骤:
(以下操作都在root下进行)
创建$LFS/tools文件夹
显示创建tools文件夹
mkdir -v $LFS/tools将tools文件夹软链接到根目录下面
ln -sv $LFS/tools /
增加lfs文件系统的用户:
增加lfs用户群和用户:
groupadd lfs useradd -s /bin/bash -g lfs -m -k /dev/null lfsuseradd参数的含义:
-s /bin/bash 让lfs的bash作为lfs的主要shell -g lfs 把用户lfs加进group lfs当中 -m 为lfs创建家目录 -k /dev/null 在安装用户目录的时候,本来系统会自动从/etc/skel里面拷贝一个范本(.bashrc之类)到/home目录里面去的,现在用-k 这个/dev/null就是默认不拷贝任何范本的意思。 lfs 用户的实际名称。设置lfs的用户密码
passwd lfs显示更换tools的拥有者。
chown -v lfs $LFS/tools显示更换sources的拥有者,换成lfs
chown -v lfs $LFS/sources用lfs登录。
su - lfs这边“-”的含义:
加上-就是login shell,不加上就是none login shell,这2者的区别用man bash 1了一下
When bash is invoked as an interactive login shell, or as a non-inter‐
active shell with the --login option, it first reads and executes com‐
mands from the file /etc/profile, if that file exists. After reading
that file, it looks for ~/.bash_profile, ~/.bash_login, and ~/.profile,
in that order, and reads and executes commands from the first one that
exists and is readable. The --noprofile option may be used when the
shell is started to inhibit this behavior.
When a login shell exits, bash reads and executes commands from the
file ~/.bash_logout, if it exists.
When an interactive shell that is not a login shell is started, bash
reads and executes commands from ~/.bashrc, if that file exists. This
may be inhibited by using the --norc option. The --rcfile file option
will force bash to read and execute commands from file instead of
~/.bashrc.
简单来说就是login shell就是切换用户的时候是用切换到的用户的环境变量,而none login shell就是用原来用户的环境变量之类,之家在.bashrc这个文件。