Linux Basic Command Operations 03

Source: Internet
Author: User
Tags create directory gpg yum repolist

Package Management

1. Make the contents of the disc file appear on the system (mount)

[Email protected] ~]# MKDIR/RHEL7

[Email protected] ~]# MOUNT/DEV/CDROM/RHEL7

Mount:/dev/sr0 write protection, will be mounted as read-only

[Email protected] ~]# LS/RHEL7


[Email protected] ~]# ls/rhel7/p (tab) #查看光驱中的安装包


2. RHEL7 rpm Package (suffix. RPM, equivalent to win. exe), convenient, no need to select the installation path and function



RPM Package MANAGER,RPM Pack Manager


–rpm-q Software name ... #查询是否安装软件包

–RPM-IVH Software Name-version information. RPM ... #安装软件包

–RPM-E Software name ... #卸载安装包



[Email protected] ~]# rpm-q Firefox

Firefox-38.3.0-2.el7_1.x86_64 #版本信息

[Email protected] ~]# rpm-q haha

Package haha not installed

[Email protected] ~]# rpm-q bash

Bash-4.2.46-19.el7.x86_64

[Email protected] ~]# rpm-q vsftpd #查询软件包是否安装


[Email protected] ~]# rpm-ivh/rhel7/packages/vsftpd-3.0.2-10.el7.x86_64.rpm #安装软件包


[Email protected] ~]# rpm-q vsftpd #查询软件包是否安装成功


[Email protected] ~]# rpm-e vsftpd #卸载软件包


[Email protected] ~]# rpm-q vsftpd #查询软件包是否卸载成功


#######################################################


Import Red Hat signature information

The package will have warning unsigned information before it has been imported

Import command: # RPM--import/rhel7/rpm-gpg-key-redhat-release


[Email protected] ~]# rpm--import/rhel7/rpm-gpg-key-redhat-release

[Email protected] ~]# rpm-q vsftpd

Vsftpd-3.0.2-10.el7.x86_64


[Email protected] ~]# rpm-e vsftpd


[Email protected] ~]# rpm-ivh/rhel7/packages/vsftpd-3.0.2-10.el7.x86_64.rpm


[Email protected] ~]# rpm-q vsftpd


After import, uninstall and re-install first


######################################################

Some installation packages need to rely on other installation packages to run, manual installation of those packages is more troublesome

Solution: Yum Package Management


Yum package management, automatically resolves dependencies

Provide services to install software

Yum to present CD content in the system

Service side to provide the data to the client requires protocol support (such as Ftp,http)

Server: There are many installation packages RPM, package warehouse Inventory (package classification for the client to provide their desired package)


1. Server, mount the optical drive device, let the system appear CD content (first create directory mkdir, above has created/RHEL7)

[Email protected] ~]# mount/dev/cdrom/rhel7/


2. Local client, modify configuration file, specify local as server #将本地客户端自己定为服务端

/etc/yum.repos.d/*.repo

[Email protected] ~]# Vim/etc/yum.repos.d/rhel7.repo


[Haha] #指明仓库名称

Name=xixi #仓库描述信息

Baseurl=file:///rhel7 #指定本地为服务端

Enabled=1 #开启本文件/Enable this warehouse

Gpgcheck=0 #不开启签名认证/Inspection


[email protected] ~]# Yum repolist #列出仓库信息, no error






Build Yum


Use of the Yum Warehouse

–yum Clean all//clear cache for increased Yun productivity

–yum repolist//Column Warehouse

Best to clear the cache before the warehouse is listed


–yum-y Install software name ...//installation software

–yum-y Remove software name ...//uninstall software



[email protected] ~]# Yum Clean all

[email protected] ~]# Yum repolist


[Email protected] ~]# yum-y install httpd


[[email protected] ~]# yum-y install GCC


[Email protected] ~]# yum-y install System-config-kickstart


[Email protected] ~]# rpm-q httpd

[Email protected] ~]# rpm-q gcc



[Email protected] ~]# Poweroff



####################################################






Three pre-configured virtual machines on each learner's machine

–classroom--provides resources such as Gateway/dns/software materials

–server--as a practice server, password Redhat

–desktop--as a practice client, password Redhat


Restore three virtual machines

[[Email protected] Desktop]# rht-vmctl Reset Classroom

[[Email protected] Desktop]# rht-vmctl Reset Server

[[Email protected] Desktop]# rht-vmctl Reset Desktop


Operating system version:

Server:cat/etc/redhat-release 7.0

Desktop:cat/etc/redhat-release 7.0


IP Address:

Server:172.25.0.11/24

Desktop:172.25.0.10/24

Real machine: 172.25.0.250/24

Classroom:172.25.254.254/24

Real-computer remote management of virtual machine server vs. Desktop:

Telnet plaintext Transmission TCP 23

SSH encrypted transmission TCP 22

Linux uses SSH remote


Format: SSH user name @ip address (IP of remote object)

Exit Remote Login

Ctrl+shift+t: Open a new terminal

Common options


-x: Allow local running of the other's graphics program


Format: Ssh-x User name @ip address


True on-machine: Permanently set the alias configuration file

[[Email protected] Desktop]# VIM/ROOT/.BASHRC


Alias s= ' ssh-x [email protected] '

Alias d= ' ssh-x [email protected] '


。。。。。。

After the setting is successful, you must turn off the true machine terminal to be reopened to take effect

[[Email protected] Desktop]# in a new terminal verification


Password: redhat


#####################################################

Configure the Network



Ifconfig command

–ifconfig [Interface name] #lo, eth0, etc.

–ifconfig-a #查看所有网卡信息

–ifconfig [Interface name] IPV4 address/Mask length

-Ifconfig NIC interface down/up #关闭/activate NIC




[[email protected] ~]# ping 127.0.0.1


[Email protected] ~]# ifconfig lo down #关闭lo


[Email protected] ~]# ping 127.0.0.1 #结果ping不通


[Email protected] ~]# ifconfig #查看不到lo


[[email protected] ~]# ifconfig-a #显示所有的网卡, including disabled Nic Lo


[[email protected] ~]# ifconfig lo up


[[email protected] ~]# ping 127.0.0.1





Configuration file/etc/hostname

– Fixed saved host name, valid for native


[Email protected] ~]# Vim/etc/hostname

S.test.com #直接写要更改的名字

[[Email protected] ~]# exit

Log out

[[Email protected] Desktop]# s

Last Login:thu Oct-15:25:23 from 172.25.0.250

[Email protected] ~]# hostname

S.test.com

[Email protected] ~]#


Network adapter Profile: IP address, subnet mask, gateway address

Path to view: Cat/etc/sysconfig/network-scripts/ifcfg-eth0


1. View the name of the network card identified by the command

[Email protected] ~]# NMCLI connection Show

Name

System eth0


2. Configure IP address, subnet mask, gateway address (permanent setting)

# NMCLI Connection Modify ' System eth0 '

Ipv4.method Manual #手动配置参数

Ipv4.addresses ' 172.25.0.11/24 172.25.0.254 '

Connection.autoconnect Yes #每次开机自动启用, each time you start to activate this network card


3. Activating the network configuration

[[email protected] ~]# nmcli connection up ' System eth0 '


[Email protected] ~]# ifconfig #激活后才能查看更改后的

[Email protected] ~]# Cat/etc/sysconfig/network-scripts/ifcfg-eth0 #前面没激活也可以查看更改的

Device=eth0 #设备名

Bootproto=none #手动配置, corresponding to the above manual manual configuration

Onboot=yes #每次开机自动启用, corresponding to the above Yes

ipaddr0=172.25.0.11 #IP地址

Prefix0=24 #子网掩码

gateway0=172.25.0.254 #网关


4. Configure a permanent DNS server,/etc/resolv.conf


In the Linux system, the configuration file content, beginning with "#" as the comment text


[[email protected] ~]# vim/etc/res (tab)

Search example.com #默认域名, can be ignored do not write

NameServer 8.8.8.8




##################################################


True on-Machine completion

1. Restart Nfs-server Shared Services

[Email protected] Desktop]# systemctl restart Nfs-server


2. Set nfs-server sharing service, random self-starting

[[Email protected] Desktop]# systemctl enable Nfs-server


3. Restore the Classroom virtual machine

[[Email protected] Desktop]# rht-vmctl Reset Classroom


4. Virtual Machine Validation

[email protected] ~]# Firefox 172.25.0.254




#####################################################

Networking: Building a yum repository, separating the server from the client

1. The service side has been completed. Classroom build Web services, CD-ROM all content

2. On the server virtual machine, specify the Yum warehouse server.

[Email protected]/]# rm-rf/etc/yum.repos.d/* #删除所有客户端文件

[Email protected] ~]# Vim/etc/yum.repos.d/abc.repo

[ABC]

Name=abc

baseurl=http://172.25.254.254/content/rhel7.0/x86_64/dvd/

Enabled=1

Gpgcheck=0


[email protected]/]# Yum repolist


#######################################################


Using the wget download tool


URL URLs for the –wget software package

URL of the –wget software package-o/directory path/new file name


# Firefox 172.25.0.254


# wget http://172.25.0.254/content/rhel7.0/x86_64/errata/Packages/kernel-3.10.0-123.1.2.el7.x86_64.rpm


# uname-r #内核版本还没更新, download finished to install


# RPM-IVH kernel-3.10.0-123.1.2.el7.x86_64.rpm #安装内核


# reboot

# Uname-r







Linux Basic Command Operations 03

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.