记录blfs书籍前几个章节的配置内容。

bash shell启动文件章节

1.切换root用户

su

2.创建/etc/profile文件

cat > /etc/profile << "EOF"
# Begin /etc/profile
# Written for Beyond Linux From Scratch
# by James Robertson <jameswrobertson@earthlink.net>
# modifications by Dagmar d'Surreal <rivyqntzne@pbzpnfg.arg> # System wide environment variables and startup programs. # System wide aliases and functions should go in /etc/bashrc. Personal
# environment variables and startup programs should go into
# ~/.bash_profile. Personal aliases and functions should go into
# ~/.bashrc. # Functions to help us manage paths. Second argument is the name of the
# path variable to be modified (default: PATH)
pathremove () {
local IFS=':'
local NEWPATH
local DIR
local PATHVARIABLE=${:-PATH}
for DIR in ${!PATHVARIABLE} ; do
if [ "$DIR" != "$1" ] ; then
NEWPATH=${NEWPATH:+$NEWPATH:}$DIR
fi
done
export $PATHVARIABLE="$NEWPATH"
} pathprepend () {
pathremove $ $
local PATHVARIABLE=${:-PATH}
export $PATHVARIABLE="$1${!PATHVARIABLE:+:${!PATHVARIABLE}}"
} pathappend () {
pathremove $ $
local PATHVARIABLE=${:-PATH}
export $PATHVARIABLE="${!PATHVARIABLE:+${!PATHVARIABLE}:}$1"
} export -f pathremove pathprepend pathappend # Set the initial path
export PATH=/bin:/usr/bin if [ $EUID -eq ] ; then
pathappend /sbin:/usr/sbin
unset HISTFILE
fi # Setup some environment variables.
export HISTSIZE=
export HISTIGNORE="&:[bf]g:exit" # Set some defaults for graphical systems
export XDG_DATA_DIRS=${XDG_DATA_DIRS:-/usr/share/}
export XDG_CONFIG_DIRS=${XDG_CONFIG_DIRS:-/etc/xdg/}
export XDG_RUNTIME_DIR=${XDG_RUNTIME_DIR:-/tmp/xdg-$USER} # Setup a red prompt for root and a green one for users.
NORMAL="\[\e[0m\]"
RED="\[\e[1;31m\]"
GREEN="\[\e[1;32m\]"
if [[ $EUID == ]] ; then
PS1="$RED\u [ $NORMAL\w$RED ]# $NORMAL"
else
PS1="$GREEN\u [ $NORMAL\w$GREEN ]\$ $NORMAL"
fi for script in /etc/profile.d/*.sh ; do
if [ -r $script ] ; then
. $script
fi
done unset script RED GREEN NORMAL # End /etc/profile
EOF

3.创建/etc/profile.d 放置各个初始化脚本的目录

install --directory --mode= --owner=root --group=root /etc/profile.d

4.创建/etc/profile.d/bash_completion.sh脚本

cat > /etc/profile.d/bash_completion.sh << "EOF"
# Begin /etc/profile.d/bash_completion.sh
# Import bash completion scripts for script in /etc/bash_completion.d/*.sh ; do
if [ -r $script ] ; then
. $script
fi
done
# End /etc/profile.d/bash_completion.sh
EOF

5.确保该目录存在

install --directory --mode= --owner=root --group=root /etc/bash_completion.d

6.创建/etc/profile.d/dircolors.sh脚本

cat > /etc/profile.d/dircolors.sh << "EOF"
# Setup for /bin/ls and /bin/grep to support color, the alias is in /etc/bashrc.
if [ -f "/etc/dircolors" ] ; then
eval $(dircolors -b /etc/dircolors)
fi if [ -f "$HOME/.dircolors" ] ; then
eval $(dircolors -b $HOME/.dircolors)
fi alias ls='ls --color=auto'
alias grep='grep --color=auto'
EOF

7.创建/etc/profile.d/extrapaths.sh脚本

cat > /etc/profile.d/extrapaths.sh << "EOF"
if [ -d /usr/local/lib/pkgconfig ] ; then
pathappend /usr/local/lib/pkgconfig PKG_CONFIG_PATH
fi
if [ -d /usr/local/bin ]; then
pathprepend /usr/local/bin
fi
if [ -d /usr/local/sbin -a $EUID -eq ]; then
pathprepend /usr/local/sbin
fi # Set some defaults before other applications add to these paths.
pathappend /usr/share/man MANPATH
pathappend /usr/share/info INFOPATH
EOF

8.创建/etc/profile.d/readline.sh脚本

cat > /etc/profile.d/readline.sh << "EOF"
# Setup the INPUTRC environment variable.
if [ -z "$INPUTRC" -a ! -f "$HOME/.inputrc" ] ; then
INPUTRC=/etc/inputrc
fi
export INPUTRC
EOF

9.创建/etc/profile.d/umask.sh脚本

cat > /etc/profile.d/umask.sh << "EOF"
# By default, the umask should be set.
if [ "$(id -gn)" = "$(id -un)" -a $EUID -gt ] ; then
umask
else
umask
fi
EOF

10.创建用于语言支持的脚本

cat > /etc/profile.d/i18n.sh << "EOF"
# Set up i18n variables
export LANG=en_US.utf8
EOF

11.创建/etc/bashrc文件

cat > /etc/bashrc << "EOF"
# Begin /etc/bashrc
# Written for Beyond Linux From Scratch
# by James Robertson <jameswrobertson@earthlink.net>
# updated by Bruce Dubbs <bdubbs@linuxfromscratch.org> # System wide aliases and functions. # System wide environment variables and startup programs should go into
# /etc/profile. Personal environment variables and startup programs
# should go into ~/.bash_profile. Personal aliases and functions should
# go into ~/.bashrc # Provides colored /bin/ls and /bin/grep commands. Used in conjunction
# with code in /etc/profile. alias ls='ls --color=auto'
alias grep='grep --color=auto' # Provides prompt for non-login shells, specifically shells started
# in the X environment. [Review the LFS archive thread titled
# PS1 Environment Variable for a great case study behind this script
# addendum.] NORMAL="\[\e[0m\]"
RED="\[\e[1;31m\]"
GREEN="\[\e[1;32m\]"
if [[ $EUID == ]] ; then
PS1="$RED\u [ $NORMAL\w$RED ]# $NORMAL"
else
PS1="$GREEN\u [ $NORMAL\w$GREEN ]\$ $NORMAL"
fi unset RED GREEN NORMAL # End /etc/bashrc
EOF

12.创建/etc/ske目录

mkdir /etc/ske

13.创建/etc/skel/.bash_profile配置文件

cat > /etc/skel/.bash_profile << "EOF"
# Begin ~/.bash_profile
# Written for Beyond Linux From Scratch
# by James Robertson <jameswrobertson@earthlink.net>
# updated by Bruce Dubbs <bdubbs@linuxfromscratch.org> # Personal environment variables and startup programs. # Personal aliases and functions should go in ~/.bashrc. System wide
# environment variables and startup programs are in /etc/profile.
# System wide aliases and functions are in /etc/bashrc. if [ -f "$HOME/.bashrc" ] ; then
source $HOME/.bashrc
fi if [ -d "$HOME/bin" ] ; then
pathprepend $HOME/bin
fi # Having . in the PATH is dangerous
#if [ $EUID -gt 99 ]; then
# pathappend .
#fi # End /etc/skel/.bash_profile
EOF

14.创建/etc/skel/.profile配置文件

cat > /etc/skel/.profile << "EOF"
# Begin ~/.profile
# Personal environment variables and startup programs. if [ -d "$HOME/bin" ] ; then
pathprepend $HOME/bin
fi # Set up user specific i18n variables
#export LANG=<ll>_<CC>.<charmap><@modifiers> # End /etc/skel/.profile
EOF

15.创建/etc/skel/.bashrc文件

cat > /etc/skel/.bashrc << "EOF"
# Begin ~/.bashrc
# Written for Beyond Linux From Scratch
# by James Robertson <jameswrobertson@earthlink.net> # Personal aliases and functions. # Personal environment variables and startup programs should go in
# ~/.bash_profile. System wide environment variables and startup
# programs are in /etc/profile. System wide aliases and functions are
# in /etc/bashrc. if [ -f "/etc/bashrc" ] ; then
source /etc/bashrc
fi # Set up user specific i18n variables
#export LANG=<ll>_<CC>.<charmap><@modifiers> # End /etc/skel/.bashrc
EOF

16.创建/etc/skel/.bash_logout文件

cat > /etc/skel/.bash_logout << "EOF"
# Begin ~/.bash_logout
# Written for Beyond Linux From Scratch
# by James Robertson <jameswrobertson@earthlink.net> # Personal items to perform on logout. # End /etc/skel/.bash_logout
EOF

17.复制配置文件至root用户下

cp /etc/skel/.* ~/

18.创建/etc/dircolors文件

dircolors -p > /etc/dircolors

19.创建/etc/issue文件内容自定义,下面贴出书中反斜杠后每个字符的意义

sudo vim /etc/issue
b             插入当前行的波特率。
d 插入当前日期。
s 插入系统名,操作系统的名称。
l 插入当前tty行名称。
m 插入机器的架构标识符,如i686。
n 插入机器的节点名,也就是主机名。
o 插入机器的域名。
r 插入内核的版本号,例如2.6.11.。
t 插入当前时间。
u 插入当前登录的用户数量。
U 插入字符串“ user”或“<n> users”,其中<n>为当前登录的用户数量。
v 插入操作系统的版本,例如,构建日期等。

我的配置文件内容

Welcome to login! \s (\l)

20.安装blfs脚本中的random脚本

make install-random

21.下载lsb_releas包并校验md5

# wget https://downloads.sourceforge.net/lsb/lsb-release-1.4.tar.gz

md5sum -c md5sums

解压并进入lsb_releas包

#tar -xvf lsb-release-1.4.tar.gz

cd lsb-release-1.4

参照书中说明编译安装

sed -i "s|n/a|unavailable|" lsb_release

./help2man -N --include ./lsb_release.examples \
--alt_version_key=program_version ./lsb_release > lsb_release. su install -v -m lsb_release. /usr/share/man/man1 &&
install -v -m lsb_release /usr/bin

返回blfs-sources目录并删除解压包目录

cd /sources/blfs-sources/

rm -rf lsb-release-1.4

22.创建用户并设置密码

useradd -m <newuser>

passwd <newuser>

23.全部配置完重启

reboot

blfs(systemv版本)学习笔记-前几章节的脚本配置的更多相关文章

  1. blfs(systemd版本)学习笔记-前几章节的脚本配置

    我的邮箱地址:zytrenren@163.com欢迎大家交流学习纠错! 记录blfs书籍前几个章节的配置内容. bash shell启动文件章节 1.切换root用户 su 2.创建/etc/prof ...

  2. Android学习笔记---前传

    在正式的撰写个人的学习笔记前,先对个人的学习经历做一个简要的介绍.座右铭:诚不欺我 1. 前言 本人非软件工程出身,属于半路出家,误打误撞进入这个行业,初心是软件开发的门槛低,自以为学习过C语言,轻度 ...

  3. STM32 FSMC学习笔记+补充(LCD的FSMC配置)

    STM32 FSMC学习笔记+补充(LCD的FSMC配置) STM32 FSMC学习笔记 STM32 FSMC的用法--LCD

  4. HBase学习笔记之HBase的安装和配置

    HBase学习笔记之HBase的安装和配置 我是为了调研和验证hbase的bulkload功能,才安装hbase,学习hbase的.为了快速的验证bulkload功能,我安装了一个节点的hadoop集 ...

  5. CAS学习笔记五:SpringBoot自动/手动配置方式集成CAS单点登出

    本文目标 基于SpringBoot + Maven 分别使用自动配置与手动配置过滤器方式实现CAS客户端登出及单点登出. 本文基于<CAS学习笔记三:SpringBoot自动/手动配置方式集成C ...

  6. C Primer Plus 学习笔记 -- 前六章

    记录自己学习C Primer Plus的学习笔记 第一章 C语言高效在于C语言通常是汇编语言才具有的微调控能力设计的一系列内部指令 C不是面向对象编程 编译器把源代码转化成中间代码,链接器把中间代码和 ...

  7. 张高兴的 Xamarin.Android 学习笔记:(一)环境配置

    最近在自学 Xamarin 和 Android ,同时发现国内在做 Xamarin 的不多.我在自学中间遇到了很多问题,而且百度到的很多教程也有些过时,现在打算写点东西稍微总结下,顺便帮后人指指路了. ...

  8. 【转】 Pro Android学习笔记(五六):配置变化

    目录(?)[-] Activity的destorycreate过程 Fragment的destorycreate过程 onSaveInstanceState saveFragmentInstanceS ...

  9. linux学习笔记-前篇

    大学毕业已经快三年了,从事嵌入式开发的工作也快三年了. 不过,老干些裸机开发,感觉很是枯燥,一咬牙一跺脚,决定从今天开始学习Linux操作系统,顺便记录下学习过程中所遇到的问题与心得. 自己从前完全没 ...

随机推荐

  1. 找出数组中求和等于y的所有子数组

    算法记录: 给定一个数组x,每个元素都是正整数,找出其中满足条件"求和等于y"的所有子数组.(简化问题,每个元素都不相等) x=[x1,...,xn],暴力搜索,复杂度O(2^n) ...

  2. 6. ASP.NET MVC 5.0 中的HTML Helper【HTML 帮助类】

    这篇文章,我将带领大家学习HTML Helper.[PS:上一篇-->5.ASP.NET MVC 中的Area[区域]是什么] HTML Helpers是用来创建HTML标签进而创建HTML控件 ...

  3. [转]kaldi上的深度神经网络

    转:http://blog.csdn.net/wbgxx333/article/details/41019453 深度神经网络已经是语音识别领域最热的话题了.从2010年开始,许多关于深度神经网络的文 ...

  4. Centos7.x gnome 桌面美化

    一.管理工具 gnome是通过gnome-tweak-tool(优化工具)来管理的,可以在左上角的应用程序->工具里找到. 也可以直接在终端输入gnome-tweak-tool来启动它.启动界面 ...

  5. CentOS第一次安装MySQL的完整步骤

    文章来自:http://www.jianshu.com/p/4a41a6df19a6,我自己调整了下 1.官方安装文档 http://dev.mysql.com/doc/mysql-yum-repo- ...

  6. callback vs async.js vs promise vs async / await

    需求: A.依次读取 A|B|C 三个文件,如果有失败,则立即终止. B.同时读取 A|B|C 三个文件,如果有失败,则立即终止. 一.callback 需求A: let read = functio ...

  7. 【xsy1503】 fountain DP

    题目大意:给你$D$个格子,有$n$个喷水器,每个喷水器有一个喷水距离$r_i$. 现在你需要在这$D$个格子中选择$n$个位置按照任意顺序安装这$n$个喷水器,需要满足$n$个喷水器互相喷不到对方. ...

  8. linux中crontab的使用方法

    crontab参数说明: -e : 执行文字编辑器来设定时程表,内定的文字编辑器是 VI,如果你想用别的文字编辑器,则请先设定 VISUAL 环境变数来指定使用那个文字编辑器(比如说 setenv V ...

  9. SQL Server性能优化(9)聚集索引的存储结构

    一.索引的概念和分类 索引的概念大家都知道,日常开发中我们也会使用常见的聚集索引.非聚集索引.但是除了这两者以外,sqlserver中还提供其他的索引,如: a. 唯一索引:不包含重复键的索引,聚集索 ...

  10. 高手速成android开源项目【tool篇】

    主要包括那些不错的开发库,包括依赖注入框架.图片缓存.网络相关.数据库ORM建模.Android公共库.Android 高版本向低版本兼容.多媒体相关及其他. 一.依赖注入DI 通过依赖注入减少Vie ...