用 CentOS 7 打造工作环境笔记

安装过程

  • 选择安装过程中使用的语言,这里应 使用英语,不要使用汉语。若安装界面使用汉语,最终安装的系统中会出现两个比较麻烦的问题:
    1. 主目录下的系统文件夹如 Downloads、Desktop 等会以中文表示,这使得在命令行 cd 变得很麻烦;
    2. 终端中某些字符用英文字体,某些字符用中文字体,效果非常差,需要自己修改终端字体方可;
  • 选择区域和城市:Asia 和 Shanghai
  • 键盘使用 English(US) 而不是 English(UK)

分区

  • 点击 “Click here to create them automatically”,即让安装程序帮忙分区
    默认的分区方案是使用 LVM,其好处在于 “当机器有多块硬盘时,在使用的时候看上去只有一块”
  • 默认的文件系统为 XFS 而不是以前常用的 EXT4;
  • 自动分区完成后,再根据自己的需求,手动修改分区细节

    • /boot :CentOS 自动分配,一定不要乱改;
    • / :根目录,合理使用并及时清理的话 15G 就够了,不过建议 30G 以上;
    • swap :与物理内存大小一致即可
    • /opt :个人习惯是将第三方软件都安装在 /opt 下,所以分了 70G
    • /home :余下的全部空间

给一般账号 root 权限

假设账户名为 qin,要授予他 root 权限,则要修改配置文件 /etc/sudoers :

su
echo 'qin ALL=(ALL) ALL' >> /etc/sudoers # 向配置文件中加入语句
tail -1 /etc/sudoers  # 检查一下是否正确
qin ALL=(ALL) ALL

添加第三方源

EPEL

EPEL 即 Extra Packages for Enterprise Linux, 为 CentOS 提供了额外的 10000 多个软件包,而且在不替换系统组件方面下了很多功夫,因而可以放心使用。

sudo yum install epel-release

执行完该命令后,在 /etc/yum.repos.d 目录下会多一个 epel.repo 文件。

ELRepo

ELRepo 包含了一些硬件相关的驱动程序,比如显卡、声卡驱动:

sudo rpm –import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
sudo rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-2.el7.elrepo.noarch.rpm

Install the EPEL repository

You install the EPEL repository by downloading the appropriate RPM package for your system and installing it. The following instructions use the 64-bit packages that work with Rackspace Cloud Servers instances.

CentOS and Red Hat Enterprise Linux 7.x

wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
sudo rpm -Uvh epel-release-latest-7*.rpm

Install the IUS repository

The IUS repository provides newer versions of some software in the official CentOS and Red Hat repositories. The IUS repository depends on the EPEL repository.

CentOS 7.x

wget https://centos7.iuscommunity.org/ius-release.rpm
sudo rpm -Uvh ius-release*.rpm

安装 yum-axelget

yum-axelget 是 EPEL 提供的一个 yum 插件。使用该插件后用 yum 安装软件时可以并行下载,大大提高了软件的下载速度,减少了下载的等待时间:

sudo yum install yum-axelget

驱动程序

NVIDIA 显卡驱动

ELRepo 源中包含了一系列驱动程序。

添加 ELRepo 源:

sudo rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
sudo rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-2.el7.elrepo.noarch.rpm

安装显卡检查程序:

sudo yum install nvidia-detect

检测显卡型号,并选择对应的驱动:

$ nvidia-detect -v
Probing for supported NVIDIA devices...
[10de:06dd] NVIDIA Corporation GF100GL [Quadro 4000]
This device requires the current 346.47 NVIDIA driver kmod-nvidia

根据 nvidia-detect 的输出信息,可以知道显卡的型号,以及要使用的驱动版本 346.47 。
安装显卡驱动

若驱动版本为 304.xx,则安装 304xx 版本:

    sudo yum install nvidia-x11-drv-304xx nvidia-x11-drv-304xx-32bit

若驱动版本为 340.xx,则安装 340xx 版本:

    sudo yum install nvidia-x11-drv-340xx nvidia-x11-drv-340xx-32bit

对于大多数比较新的显卡来说,直接安装最新版的驱动即可:

    sudo yum install nvidia-x11-drv nvidia-x11-drv-32bit

安装过程中可能会给出软件冲突的警告,需要卸载以下软件包及其依赖:

sudo yum remove xorg-x11-glamor

重启

手动编译显卡驱动

准备工作

查看显卡型号

$ lspci | grep VGA
03:00.0 VGA compatible controller: NVIDIA Corporation GF100GL [Quadro 4000] (rev a1)

从这里可以得出显卡型号为 Quadro 4000。

驱动下载

下载地址为: http://www.nvidia.com/Download/index.aspx?lang=en-us

安装显卡驱动

安装 kernel-devel

sudo yum install kernel-devel

将 nouveau 驱动加入黑名单,在 /etc/modprobe.d/blacklist.conf (CentOS 7 下为 /usr/lib/modprobe.d/dist-blacklist.conf )中加入 blacklist nouveau

备份 initramfs 文件

sudo mv /boot/initramfs-$(uname -r).img /boot/initramfs-$(uname -r).img.bak

重建 initramfs 文件

sudo dracut -v /boot/initramfs-$(uname -r).img $(uname -r)

关机重启。由于此时 nouveau 驱动已经被禁用,桌面的显示效果非常差。

进入文本界面

sudo init 3

会直接进入文本界面。

在文本界面登录后直接安装

sh NVIDIAxxx --kernel-source-path=/usr/src/kernels/x.xx.x-xxxxx

其中 NVIDIAxxx 为 nvidia 驱动脚本文件, x.xx.x-xxxx 为 kernel 版本号。

更新 kernel 后重装驱动

手动编译显卡驱动的一个麻烦之处在于,每次更新 kernel 之后,都会出现无法进入图形界面的情况,此时需要重新安装显卡驱动。

更新 kernel,重启,发现无法进入图形界面;
按下 Alt+F2 ,进入文本界面,以 root 身份登陆;
备份 initramfs 文件
重建 initramfs 文件
重启,按下 Alt+F2 ,进入文本界面,以 root 身份登陆;
执行第七步;再重启;

卸载显卡驱动

sh ./NVIDIA-Linux-xxxxx –uninstall

娱乐

影音播放器

Nux Dextop 提供了 mplayer 和 VLC,可以用于播放常见格式的音频和视频,二者选其一安装即可:

sudo yum install mplayer
sudo yum install vlc

windows 10 远程连接CentOS 7 的桌面

链接地址

代理服务器设置:

配置文件

1) /etc/profile: 此文件为系统的每个用户设置环境信息,当用户第一次登录时,该文件被执行. 并从/etc/profile.d目录的配置文件中搜集shell的设置。

(2) /etc/bashrc: 为每一个运行bash shell的用户执行此文件.当bash shell被打开时,该文件被读取(即每次新开一个终端,都会执行bashrc)。

(3) ~/.bash_profile: 每个用户都可使用该文件输入专用于自己使用的shell信息,当用户登录时,该文件仅仅执行一次。默认情况下,设置一些环境变量,执行用户的.bashrc文件。

(4) ~/.bashrc: 该文件包含专用于你的bash shell的bash信息,当登录时以及每次打开新的shell时,该该文件被读取。

(5) ~/.bash_logout: 当每次退出系统(退出bash shell)时,执行该文件. 另外,/etc/profile中设定的变量(全局)的可以作用于任何用户,而~/.bashrc等中设定的变量(局部)只能继承 /etc/profile中的变量,他们是”父子”关系。

(6) ~/.bash_profile: 是交互式、login 方式进入 bash 运行的~/.bashrc 是交互式 non-login 方式进入 bash 运行的通常二者设置大致相同,所以通常前者会调用后者。

全局的代理设置:

vi /etc/profile

添加下面内容

http_proxy = http://username:password@yourproxy:8080/
ftp_proxy = http://username:password@yourproxy:8080/
export http_proxy
export ftp_proxy

yum的代理设置:

vi /etc/yum.conf

添加下面内容

proxy = http://username:password@yourproxy:8080/

或者

proxy=http://yourproxy:808
proxy=ftp://yourproxy:808
proxy_username=username
proxy_password=password

Wget的代理设置:

vi /etc/wgetrc

添加下面内容

Proxy

http_proxy=http://username:password@proxy_ip:port/
ftp_proxy=http://username:password@proxy_ip:port/

修订历史

2017-01-25 初稿

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值