Linux_04
A.安装gcc
1.rpm -ivh安装gcc
使用rpm -ivh安装,这种方法需要手动安装依赖
根据安装提示,安装相应的依赖,比较麻烦
[root@localhost Desktop]# cd /run/media/root/RHEL-7.0\ Server.x86_64/ ## 进入光驱路径 [root@localhost RHEL-7.0 Server.x86_64]# cd Packages/ ## 进入Packages [root@localhost Packages]# pwd /run.media/root/RHEL-7.0 Server.x86_64/Packages [root@localhost Packages]# ls | grep gcc ## 查看文件 compat-gcc-44-4.4.7-8.el7.x86_64.rpm compat-gcc-44-c++-4.4.7-8.el7.x86_64.rpm gcc-4.8.2-16.el7.x86_64.rpm gcc-c++-4.8.2-16.el7.x86_64.rpm gcc-gfortran-4.8.2-16.el7.x86_64.rpm gcc-gnat-4.8.2-16.el7.x86_64.rpm gcc-ojbc-4.8.2-16.el7.x86_64.rpm gcc-ojbc++-4.8.2-16.el7.x86_64.rpm libgcc-4.8.2-16.el7.i686.rpm libgcc-4.8.2-16.el7.x86_64.rpm [root@localhost Packages]# rpm -ivh gcc-4.8.4-16.el.x86_64.rpm ## 选择安装
2.将镜像放到仓库中,并使用yum install安装
该方法自动安装所需要的依赖
[root@localhost Desktop]# rm -fr /etc/yum.repos.d/* ## 删除该文件 [root@localhost Desktop]# mkdir /rhel7 ## 建立目录 [root@localhost Desktop]# mount /dev/sr0 /rhel7/ ## 将光驱导入目录中 mount: /dev/sr0 is write-protected,mounting read-only [root@localhost Desktop]#vim /etc/yum.repos.d/yum.repo ## 编写文件 [root@localhost Desktop]#cat /etc/yum.repos.d/yum.repo ## 查看文件内容 [rhel7] bane=rhel7 baseurl=file:///rhel7 gpgcheck=0 [root@localhost Desktop]#yum repolist ## 读取仓库 Loaded plugins: langpacks repolist:0 [root@localhost Desktop]#yum repolist ## 再次读取仓库 Loaded plugins: langpacks repo id repo name rhel7 rhel7 repolist: 4,305 [root@localhost Desktop]# yum install gcc-4.8.2-16.el7.x86_64.rpm ## 安装gcc一步到位
B.yum命令
1.常用命令
install softwarename 安装 repolist 列出设定yum源信息 remove softwarename 卸载 list softwarename 查看软件源中是否有次软件 list all 列出所有软件名称 list installd 列出已安装的软件名称 list available 列出可用yum安装的软件名称 clean all 清空yum缓存 serach softwarename 根据软件信息搜索软件名字 whatprovides filename 在yum源中查找包含filename文件的软件包 update 更新软件 history 查看系统软件改变历史 reinstall softwarename 重新安装 info softwarename 查看软件信息 groups list 查看软件组信息 groups info softwaregroup 查看软件组内包含的软件 groups install softwaregroup 安装组件 groups remove softwaregroup 卸载组件
2.安装和卸载eclipse
[root@localhost Desktop]# yum serach eclipse ## 查找eclipse信息 Loaded plugins: langpacks ================================N/S matched: eclipse================================ ecj.x86_64 : Eclipse Compiler for Java Name and summary matches only, use "serach all" for everything. [root@localhost Desktop]# yum install ecj ## 安装eclipse [root@localhost Desktop]# yum reinstall ecj ## 重装eclipse [root@localhost Desktop]# yum remove ecj ## 卸载eclipse
C.忘记系统密码
1.重启
在系统选择页面停止,按c进入编辑界面
按照如下显示进行修改
将linux16起头结尾开始删除,一直删除到ro,将o改为w,后面添加rd.break
2.执行完上一步,按Ctrl-x
按下图操作
操作完成,输入两次exit,即系统重启
D.救援模式(虚拟机中操作:删除boot目录,导致无法启动)
1.首先设置虚拟机启动为虚拟光驱(光驱放在第一个)
2.重启
系统无法启动,选择进入救援模式,最后一项
3.再次选择
4.得到一个shell
输入 chroot /mnt/sysimage
5.进入目录
6.安装系统内核
7.最后做一个引导
8.重启,将第一步设置的光盘还原