Linux Network Foundation settings and software Installation

Source: Internet
Author: User
Tags yum repolist

First, Linux Network Infrastructure Settings

Network settings can be basically divided into: Nic settings, gateway settings, DNS set up three parts

    • ifconfig Command

ifconfig command is used to configure and display network parameters for network interfaces in the Linux kernel. The NIC information configured with the Ifconfig command does not exist after the machine restarts after the network card restarts. In order to keep the above configuration information in the computer forever, it is necessary to modify the network card configuration file.

Parameters

add< Address: Set the IP address of the network device IPV6;

del< Address: Delete the IP address of the network device IPV6;

Down: Closes the specified network device;

Up: Start the specified network device;

netmask< subnet mask;: Set subnet mask for network device;

IO_ADDR<I/O Address: Set the I/O address of the network device;

IRQ<IRQ Address: Set the IRQ for the network device;

media< network media type;: Set the media type of network equipment;

mem_start< memory Address: Set the starting address occupied by the network device in main memory;

Number of metric<;: Specifies the number to be added when calculating the number of packets to be transferred;

mtu< byte;: Sets the MTU of the network device;

tunnel< Address: Establish a tunnel communication address between IPV4 and IPV6;

-broadcast< Address: Packets destined for the specified address are treated as broadcast packets;

-pointopoint< address;: Establish a direct connection with the network device of the specified address, this mode has the secrecy function;

-promisc: Turn off or start the promiscuous mode of the specified network device;

IP Address: Specifies the IP address of the network device;

For example, modify the command for the IP address of the ENS33 network card with the 198.172.16.23 and subnet mask 255.255.255.0:

Ifconfig ens33 198.172.16.23 netmask 255.255.255.0

The Ifgonfig command displays the following information:

The first display is the network card name, common are: ens33 eth0 eth1 em1 em2 p2p2 p3p3, etc.

If the network card does not start, the displayed information is usually no IP address. Start the NIC to use ifconfig up.

Ifup: Start the specified NIC on the system

Ifdown: Stop the network adapter specified on the system

The above two commands are the same as Ifconfig Up/down.

Example 2:

After the colon, ' 0 ' means virtual one network card, the IP of the network card can be set arbitrarily, but the MAC address and one of the enabled network card is consistent, two with one hardware.

Ps:

The network card settings set by the command are temporary, and you want to change the network card settings permanently, you need to change the settings document.

If you can't connect, you may need to reset your firewall settings:

    • To change the NIC configuration file

To change the NIC configuration permanently, you need to change the NIC configuration file.

Network card profile: the NIC corresponding to the name file that starts with/ETC/SYSCONFIG/NETWORK-SCRIPTS/IFCFG-XXXX:IFCFG-XX. You can change the configuration file and then restart the Network service in effect configuration. If the NIC does not have the following entries, it can be added to the file manually.

Type: Types

Bootproto: Network card operating mode (static or dynamic)

Ipaddr:ip Address

NETMASK: Subnet Mask

Onboot: When the service starts, whether to start the network card

DNS1: Primary DNS Address

DNS2: Secondary DNS Address

Gateway: Gateways Address

An example:

Attention:

The last noboot option must be yes in order for the network card to start automatically when it starts.

You need to restart the network after the file changes, you can use the following command:

Service Network status NIC

Service Network stop Stop network card

Service Network start Start network card

Service Network restart restart NIC

Ruote-n: View network Management

Systemctl (ibid. service) CENTOS7 can be used

    • DNS Configuration

Modifying the DNS server is simple and requires only modifying the/etc/resolv.conf configuration file.

Cases:

Domain name resolution Priority: The priority of/etc/hosts is higher than the resolution priority of the configured DNS

    • Gateway Settings

You can use the route command to

Cases:

Route Gateway Configuration

The route command is used to display and set the network routing table in the Linux kernel, and the routing is primarily static.

Command format:

Route [options] [parameters]

Note: Query routing information is not represented with any options and parameters after route

Common options:

-V: Show detailed routing information

Add: Increase the specified routing record or Gateway

Del: Delete the specified route record or gateway

GW: Setting the default gateway

Dev: The network interface represented by the route record

Example configuration:

Route add-net 192.168.1.0 netmask 255.255.255.0 Add a routing to 192.168.1.0

Route del-net 192.168.1.0 netmask 255.255.255.0 Delete a route to 192.168.1.0

Route add default GW 192.168.1.250 Specifies that the gateway is 192.168.1.250

Route del default GW 192.168.1.250 Delete the defaults gateway 192.168.1.250

Second, software Installation

    • RPM Package

The RPM command is a management tool for RPM packages. RPM was originally a red Hat Linux distribution program designed to manage Linux packages and is popular because it follows GPL rules and is powerful and convenient. is gradually being adopted by other distributions. The advent of RPM suite management means that Linux is easy to install and upgrade, which indirectly increases the applicability of Linux.

Grammar

RPM (option) (parameter)

Options

-A: query all packages;

-b< Completion Phase >< Kit file >+ or-t < finish phase >< Kit file >+: Set the completion phase of the packaging kit and specify the file name of the kit file;

-C: Only configure configuration files are listed, this parameter should be used with "-l" parameter;

-D: Only text files are listed, this parameter should be used with "-l" parameter;

-e< Kit File > or--erase< kit;: delete the specified package;

-f< file >+: Query The suite that owns the specified file;

-H or--hash: The tag is listed when the kit is installed;

-I: Displays information about the kit;

-i< Kit File > or--install< kit;: Install the specified kit file;

-L: Displays a list of files for the suite;

-p< Kit File >+: Query the specified RPM kit file;

-Q: Using the inquiry mode, the rpm instruction will ask the user first when any problems are encountered;

-r: Displays the correlation information of the kit;

-S: Display the file status, this parameter should be used with "-l" parameter;

-u< Kit File > or--upgrade< kit;: Upgrade the specified package file;

-V: Displays the instruction execution process;

-VV: Shows the instruction execution process in detail, which is convenient for troubleshooting.

[Email protected] ~]# RPM-QA #查询所有已经安装的软件包, output information omitted [[email protected]-python ~]# RPM-QL gcc #查询gcc安装后能产生哪些文件, output information omitted [[email protected]-python ~]# rpm-qf/usr/share/info/gcc.info.gz #查看该文件属于哪个软件包gcc-4.8.2- -. El7.x86_64[[email protected]-python ~]# RPM-qi gcc #查询gcc的包信息, including version, platform, developer, etc., output information has been omitted [[email protected]-python packages]# RPM-IVH dhcp-4.2.5- -. el7.centos.x86_64.rpm #安装dhcpPreparing ... ################################# [ -%]updating/Installing ...1:d hcp- A:4.2.5- -. El7.centos ################################# [ -%][[email protected]-python packages]# RPM-EVH dhcp-4.2.5- -. el7.centos.x86_64 #卸载dhcpPreparing ... ################################# [ -%]cleaning up/removing ...1:d hcp- A:4.2.5- -. El7.centos ################################# [ -%][[email protected]-python packages]# RPM-QR dhcp-4.2.5- -. el7.centos.x86_64 #查看已经安装了的dhcp包有哪些依赖关系, the output information has been omitted

    • Yum Package management tool

The Yum command is a RPM-based package manager developed by Redhat, which enables system administrators to interactively and automatically manage RPM packages, automate the download of RPM packets from a specified server, install them automatically, handle dependency relationships, and install all dependent software packages at once. No need to cumbersome to download, install.

Yum provides commands for finding, installing, and deleting one, a group, or even all of the packages.

The implementation of the Yum command relies on the Yum service to run, and Yum installs the packages and updates from the network package repository, so using Yum requires reading the relevant information from a source configuration file.

Yum Source config file:/etc/yum.repos.d/<name>.repo,name name itself, suffix must be repo

Grammar

Yum (option) (parameter)

Options

-H: Displays help information;

-Y: Answer "yes" to all questions;

-C: Specify the configuration file;

-Q: Quiet mode;

-V: Verbose mode;

-D: Set debug Level (0-10);

-E: Set error level (0-10);

-R: Sets the maximum wait time for Yum to process a command;

-C: Run completely from the cache without downloading or updating any header files.

Install the RPM package

Update updates RPM Package

Check-update Check if an updated RPM package is available

Remove removes the specified RPM package

List displays information about the package

Search Check the package information

Info displays description and summary information for the specified RPM package

Clean cleanup Yum Expired cache

RESOLVEDEP show dependencies for RPM packages

Localinstall installing the local RPM package

Localupdate Show local RPM package for update

Deplist Show all dependencies for RPM packages

Groups Package Group Management

Set up the Yum Library yourself:

[Email protected] packages]# cat/etc/yum.repos.d/dvd.repo [DVD] #yum源的库名字, it's your own definition, preferably the same as the filename =
   
    dvd #yum源的库的说明信息, custom BaseURL=file:/
    /
    mnt #yum源的库的地址, file://represents a local library,/mnt represents a path, and can also be used in HTTP ://ip/path, Ftp://ip/path and other remote libraries, remote libraries need to use related services for file sharing gpgcheck=
    0 
     #是否进行gpg签名校验enable=
    1 #开启该yum源配置, default is open, can not write this line
   

Application Examples:

[[Email protected] ~]# Yum list #列出所有库所提供的软件包列表 [[email protected]-python ~]# Yum Install vsftpd-y #安装vsftpd [[email protected]-python ~]# Yum Remove VSFTPD-y #删除vsftpd [[email protected]-python ~]# Yum deplist vsftpd #列出vsftpd的依赖关系 [[email protected]-python ~]# Yum Info vsftpd #查看vsftpd的描述和概要信息 [[email protected]-python ~]# yum Groups list #列出所有软件包组 [[email protected]-python ~]# yum Groups install KDE #安装KDE软件包组 [[email protected]-python ~]# Yum Search dhcp #查找并显示dhcp的信息 [[email protected]-python ~]# Yum Clean all #清除缓存信息 [[email protected]-python ~]# Yum repolist #查看源库的列表, the library can be specified multiple, can be written in a repo file, can also be written separately

    • Source Code Package

The installation of the source code package generally consists of 4 steps: Extract the source code package, configuration (Configure), compile (make), install (makes install), the following will be python3.6.1 as an example explanation

Extract the source code package:

The source code package is generally used in GZ, bz2 (using tar to unpack), and some using XZ (xz-d decompression), zip (unzip decompression)

Configuration (Configure):

After each package decompression, the internal basic has configure file, the following configure file

[Email protected] ~]# CD python-3.6.1/[[Email protected]-python python-3.6.1]# lsaclocal.m4 config.sub Include Mac Modules Programs Python setup.p Ybuild Configure install-sh Makefile Objects pybuilddir.txt python-config toolsconfig.guess configure.ac Lib makefile.pre Parser pyconfig.h python-config.pyconfig.log Doc libpython3.6m.a makefile.pre.inchPC pyconfig.h.inchpython-gdb.pyconfig.status Grammar LICENSE Misc pcbuild python readme.rst

Configure is an executable configuration script that has many options for using commands under the source path to be installed./configure–help output detailed list of options

Generally used in one, the--prefix option is to configure the path of software installation, if not configured, after the installation executable file is placed by default in/usr/local/bin, the library file is placed by default in/usr/local/lib, the configuration file is placed by default in/usr/local/etc , the other resource files are placed in the/usr/local/share, and the specified path is stored in the corresponding directory.

[Email protected] python-3.6. 1] #./configure--prefix=/usr/local/python3 #配置安装路径为/usr/local/python3

Compile (make):

Execute the Make command under the source code path, when make executes, it searches the current directory for the makefile file, and the makefile file records the details of the source code software compilation, which is performed using environments such as the GCC compilation environment, the Zlib function library, and so on. The lack of a corresponding software environment can lead to compilation failure, the general reason for failure will prompt, the user is generally able to solve the prompt.

[Email protected] python-3.6. 1] # make

Compile and install (make install):

The make install installs the last compiled data into the configured directory according to the Install option in makefile, and you want to uninstall the installed source code package, you can use make uninstall (configure configuration and do compile required).

[Email protected] python-3.6. 1] # make Install

The installation is complete at this point, but the following system's environment variables need to be modified to use python3.6.1

Software post-installation configuration:

Writes the execution file path of the python3.6.1 to the environment variable configuration file, which is not valid.

[Email protected] python-3.6. 1] # echo  'export path= ' $PATH:/usr/local/python3/bin "' >>/etc/profile[[ Email protected]-python python-3.6. 1] # Source/etc/profile

Verify:

[Email protected] python-3.6.1]# PIP3-Vpip9.0.1  from/usr/local/python3/lib/python3.6/site-packages (python3.6) [[email protected]-python python-3.6.1]# Python3python3.6.1(default, May -  ., A: the: $) [GCC4.8.2 20140120(Red Hat4.8.2- -)] on Linuxtype" Help","Copyright","credits"Or"License"  forMore information.>>> exit ()

  

Linux Network Foundation settings and software Installation

Related Article

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.