源碼編譯coreutils-8.22

編譯環境:
OS:CentOS Linux release 7.8.2003 (Core)

# gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/4.8.5/lto-wrapper
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-linker-hash-style=gnu --enable-languages=c,c++,objc,obj-c++,java,fortran,ada,go,lto --enable-plugin --enable-initfini-array --disable-libgcj --with-isl=/builddir/build/BUILD/gcc-4.8.5-20150702/obj-x86_64-redhat-linux/isl-install --with-cloog=/builddir/build/BUILD/gcc-4.8.5-20150702/obj-x86_64-redhat-linux/cloog-install --enable-gnu-indirect-function --with-tune=generic --with-arch_32=x86-64 --build=x86_64-redhat-linux
Thread model: posix
gcc version 4.8.5 20150623 (Red Hat 4.8.5-39) (GCC)
# make -v
GNU Make 3.82
Built for x86_64-redhat-linux-gnu
Copyright (C) 2010  Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

安裝軟件:

# yum install -y automake autoconf
# yum install -y intltool
# yum install -y libtool
# yum install -y gcc-c++
# yum install -y unzip wget
# yum install -y bison
# yum install -y gperf
# yum install -y texinfo

編譯步驟:
1.# git clone -b v8.22 https://github.com/coreutils/coreutils.git
2.# unzip coreutils-8.22.zip
3.# cd coreutils-8.22
下面的步驟需要在非root用戶下運行,所以先創建一個用戶
4.# useradd -d /home/chen chen
5.# passwd chen
修改權限

1.切換到root用戶下,怎麼切換就不用說了吧,不會的自己百度去.

2.添加sudo文件的寫權限,命令是:
chmod u+w /etc/sudoers

3.編輯sudoers文件
vi /etc/sudoers
找到這行 root ALL=(ALL) ALL,在他下面添加xxx ALL=(ALL) ALL (這裏的xxx是你的用戶名)

ps:這裏說下你可以sudoers添加下面四行中任意一條
youuser            ALL=(ALL)                ALL
%youuser           ALL=(ALL)                ALL
youuser            ALL=(ALL)                NOPASSWD: ALL
%youuser           ALL=(ALL)                NOPASSWD: ALL

第一行:允許用戶youuser執行sudo命令(需要輸入密碼).
第二行:允許用戶組youuser裏面的用戶執行sudo命令(需要輸入密碼).
第三行:允許用戶youuser執行sudo命令,並且在執行的時候不輸入密碼.
第四行:允許用戶組youuser裏面的用戶執行sudo命令,並且在執行的時候不輸入密碼.

4.撤銷sudoers文件寫權限,命令:
chmod u-w /etc/sudoers

這樣普通用戶就可以使用sudo了.
參考:https://www.cnblogs.com/zox2011/archive/2013/05/28/3103824.html

切換到普通用戶
6.$ ./bootstrap
7.$ ./configure
8.$ make
9.$ make install

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章