Three Linux software installation methods

Source package installation

Disadvantages: you need to install the c language library

To install the source package, you need to install the compiler:

yum install -y gcc gcc-c++ make
  1. gcc is a GNU Compiler Collection (GNU compiler suite), or simply a compiler. It can compile many programming languages (including C, C + +, Objective-C, Fortran, Java, etc.).
  2. When your program has only one source file, you can compile it directly with gcc command.
  3. However, when your program contains many source files, make tool can be regarded as an intelligent batch processing tool. It does not have the function of compiling and linking, but uses a method similar to batch processing - to translate and link by calling the commands specified by the user in the makefile file file.
  4. The make tool compiles and links according to the commands in the makefile., The makefile command contains the command to call gcc (or another compiler) to compile a source file.

3. But when your program contains many source files,

Recommended installation location: / usr/local

  • Installation steps
  1. Download the source code installation package
  2. decompression
  3. And enter
  4. make compilation
    make install compile install

RPM installation

Disadvantages: the dependency cannot be solved. For example, when installing software a, software b and software c must be installed

Only the installation package is available

  • RPM package installation location
routemeaning
/etc/Profile installation directory
/usr/bin/Executable command installation directory
/usr/lib/Where to save the function library used by the program
/usr/share/doc/Storage location of basic software user manual
/usr/share/man/Help file save location
  • RPM command:
rpm

parameter
-i: Install package
-q: Ask about the package, and-a Use together to list and install all packages
-e: Delete package
-U: Upgrade an installed package
-V: Verify installed packages
-h: Display installation progress bar
--nodeps : Do not check dependencies

Combined use
-ivh: install
-Uvh: upgrade
-qa: query
-e: uninstall

Yum installation

centOS can try out the tools for installing RMP package held by redhat for free, and redhat needs to pay

  • yum common commands for package operation:
1.use YUM Find packages 
Command: yum search 

2.List all installable packages 
Command: yum list 

3.List all updatable packages 
Command: yum list updates 

4.Lists all installed packages 
Command: yum list installed 

5.List all installed but not Yum Repository Software package in 
Command: yum list extras 

6.Lists the specified packages 
Command: yum list 

7.use YUM Get package information 
Command: yum info 

8.List information for all packages 
Command: yum info 

9.Lists all updatable package information 
Command: yum info updates 

10.Lists all installed package information 
Command: yum info installed 

11.List all installed but not Yum Repository Package information in 
Command: yum info extras 

12.List which files the package provides 
Command: yum provides

Create your own warehouse

Check the warehouses provided by the system (you must be able to access the Internet when using these warehouses)

ls /etc/yum.repos.d/

1. Create a directory as a warehouse

cd /etc/yum.repos.d/
mkdir myyum

2. Move the things in the system warehouse to the warehouse we created

mv CentOS* myyum/

3. Write warehouse information

cd /etc/yum.repos.d/
vi myyum.repo//The only suffix to be written on the system indicates that this directory is a warehouse

About five lines should be written in this file

  1. [name]

Name is the name of the warehouse

  1. name = It is yum cdrom

It is yum cdrom is a description of this file

  1. baseurl= file: / / / package path

The location of the software package can be file, ftp or http

  1. enable=1

1 indicates that the path is available and 0 indicates that it is not available

  1. gpgcheck=0

Whether to check the gpg is not checked by default. If so, import the public key and private key


4. Clear and inspect the warehouse

yum clean all  //Clear source cache
yum repolist   //Check yum source
yum list       //View files from yum source

5. Start installation

yum search  Package name  //Search package
yum install Package name  //Install package
yum remove  Package name  //Delete package

Minimize Linux Installation of some common software (restart required)

yum install vim -y //Default consent required to install vim editor -y
yum install bash-completion  //Automatic completion of installation command

Linux service management

Service classification

  • Query installed services

1. Services installed by RPM package:

service --status -all  //You can see all the service status of rpm (exclusive to red hat)

chkconfig -list    //View the status of all self starting services

2. Services installed in source package:

Check the service installation location, usually under / usr/local /

RPM package installed services

1. Independent service

/etc/init.d /: start script location J
/etc/sysconfig /: initialization environment configuration file location
/etc /: configuration file location
/etc/xinetd.conf: xinetd configuration file
/etc/xinetd.d /: startup script based on xinetd service
/var/lib /: put the data generated by the service here
/var/log /: log

  • Start of independent service

/etc/init.d / independent service name start|stop|status|restart|

  • Self start of independent service

1. Chkconfig [-- level run level] [independent service name] [on | off] ([] means optional)
2. Modify / etc / RC d/rc. Local file
3. Use ntsysv command to manage self startup

2. xinetd based service
  • Installing xinetd and telnet

less and less

yum -y install xinetd
yum -y install telnet-server

Source package service

1. Startup of source package installation service

Using the absolute path, call the startup script to start. Different source packages have different startup scripts. You can view the installation instructions of the source package and the method of starting the script.

/usr/local/apache2/bin/apachectl   start | stop

2. Self start of source package service

vi /etc/rc. d/rc. local

join
/usr/local/apache2/bin/apachectl start

Keywords: Linux Operation & Maintenance server

Added by Fahid on Thu, 03 Feb 2022 04:34:21 +0200