Linux note: Common Feature Highlights

Network configuration

On Linux configuration card, is in the
/ etc / sysconfig / network-scripts / ifcfg-ensxx
like this file, each file corresponds to a card
which is configured with the address information of the network card, the DNS information, and obtains the IP address of the manner is Dhcp or static mode and so on.

After the changes, you can modify the network services
service network restart

TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=dhcp
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=ens33
UUID=0489a779-6e90-402e-86e0-9d1643123675
DEVICE=ens33
ONBOOT=no

network-scripts invoked where
/etc/rc.d/init.d/network script
this script at startup, the system will automatically be invoked, because the init.d directory of the script will be self-starting, and can be chkconfig start the characteristics to be modified

Detailed configuration in detail

DEVICE="eth1"					#网卡名称
NM_CONTROLLED="yes"				#networkmamager的参数,是否可以由NNetworkManager托管
HWADDR=							#MAC地址
TYPE=Ethernet					#类型
PREFIX=24						#子网掩码24位
DEFROUTE=yes					#就是defaultroute,是否把这个eth设置为默认路由
ONBOOT=yes						#设置为yes,开机自动启用网络连接
IPADDR=							#IP地址
BOOTPROTO=none					#设置为none禁止DHCP,设置为static启用静态IP地址,设置为dhcp开启DHCP服务
NETMASK=255.255.255.0			#子网掩码
DNS1=8.8.8.8					#第一个dns服务器
BROADCAST						#广播
UUID							#唯一标识
TYPE=Ethernet					#网络类型为:Ethernet
GATEWAY=						#设置网关
DNS2=8.8.4.4#					#第二个dns服务器
IPV6INIT=no						#禁止IPV6
USERCTL=no						#是否允许非root用户控制该设备,设置为no,只能用root用户更改
NAME="Systemeth1"				#这个就是个网络连接的名字
MASTER=bond1					#指定主的名称
SLAVE							#指定了该接口是一个接合界面的组件。
NETWORK							#网络地址	
ARPCHECK=yes					#检测	
PEERDNS							#是否允许DHCP获得的DNS覆盖本地的DNS	
PEERROUTES						#是否从DHCP服务器获取用于定义接口的默认网关的信息的路由表条目	
IPV6INIT						#是否启用IPv6的接口
IPV4_FAILURE_FATAL=yes			#如果ipv4配置失败禁用设备
IPV6_FAILURE_FATAL=yes			#如果ipv6配置失败禁用设备

Construction services

Related start

In the / etc directory, there are
rcx.d rc.local file folders, and
Here Insert Picture Description
you can see the files under the same directory references from the rc.d directory rc.local file references the same name from under the rc.d directory
Here Insert Picture Description

Generally if you want a program from the start, it can rc.local written, but with numbers corresponding to these directories should be started at different levels, you need to perform the script

/etc/rc.d/init.d

This folder contains all the services all startup scripts run in each grade in. Generally, they are standard shell scripts, to comply with minimum standards. Each script accepts two parameters at least start and stop, which represent start and stop services (such as web services). In addition, init script usually will accept some additional options, such as restart (reboot the server), status (returns the current state of service), reload (inform service from a configuration file reload configuration) as well as force-reload (mandatory service reload its configuration). As a way to run a script without parameters, the general should return a list of parameters it will accept.

/etc/rc.d/rc0.d~/etc/rc.d/rc6.d

These folders contain, respectively, for each run level init script corresponding. In actual use, they are generally linked to the actual file through the symbolic /etc/init.d folder. However, to note that, init script which folder has some special name, are named with S (start) (disable) the beginning of the K (kill) or D, followed by a number. When init enters a run level when it runs all the scripts beginning with the K and stop the incoming parameters, unless corresponding init script does not start a run in the front rank in numerical order. Then init runs all the scripts beginning with S, in numerical order and pass start parameters. Any overlooked beginning with the D init script will be - this allows you to ban a script to run at a specified level, or you can just remove all symbolic links. So if you have two scripts, S01foo and S05bar, init will first run S01foo start, when it enters a particular run level after the implementation S05bar start.

/etc/rc.d/rc.local

Not all distributions are used rc.local, it is usually a left to the user to modify the shell script . It is usually run at the end of the init process, so you can put here some additional scripts you want to run, and do not have to create your own init scripts.

/etc/inittab

This document is to define the level of file start, but after centos7, has asked to be set by systemctl set-default
mode is the service, this command allows us to open and close operation of the service.

Mount the partition

Prior to mount, there must be a target directory can be mounted, so here you need to create a directory. For us to mount.

mkdir /var/iso
mount -o loop CentOS-6.7-x86_64-bin-DVD1.iso /var/iso
mount命令后接挂载的类别。可以指定多种类型。

YUM local sources of production

Why should I make?

YUM source Although we can simplify the process of installing software on Linux, but the resulting environment is often no Internet access, YUM source can not be connected to external networks, then you can not say to use the yum command to install the software. For the internal network can also be used yum install the relevant software, it is necessary to configure yum source.

principle

YUM it is actually a source server holds multiple RPM packages can be retrieved via http way to download and install any RPM package

step

  1. Prepare a Linux server, using the simplest version of CentOS-6.7-x86_64-minimal.iso
  2. Configure the IP address of this server
  3. Upload CentOS-6.7-x86_64-bin-DVD1.iso to the server
  4. The CentOS-6.7-x86_64-bin-DVD1.iso mirror mounted to a directory
mkdir /var/iso
mount -o loop CentOS-6.7-x86_64-bin-DVD1.iso /var/iso
  1. YUM modify the configuration file on the source machine, the source point to their own
    backup of the original source of YUM's profile
cd /etc/yum.repos.d/
rename .repo .repo.bak *
vi CentOS-Local.repo

Configuration file structure

[base]
name=CentOS-Local
baseurl=file:///var/iso
gpgcheck=1
enabled=1   #很重要,1才启用
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

Add the above content to save and exit

  1. Clear YUM buffer
    yum clean all
  2. List available source YUM
    yum repolist
  3. Install the appropriate software
    yum install -y httpd
  4. Open httpd using a browser to access http://192.168.0.100:80 (if access blocked, check the firewall is turned on or off the firewall port 80)
    service httpd start
  5. The YUM source configured to httpd (Apache Server), the other servers to access the YUM source within the network through a network
    cp -r /var/iso/ /var/www/html/CentOS-6.7
  6. Cancel previously mounted mirror
    umount /var/iso
  7. Access http://192.168.0.100/CentOS-6.7/ in your browser
Published 73 original articles · won praise 55 · Views 200,000 +

Guess you like

Origin blog.csdn.net/blueboz/article/details/88372930