对于我这个半路子运维最头疼的就是linux上软件的安装和配置。方式多,乱,不像windowsd
一路next就好。这也是开源的灵活的优点和缺点了。但人善于归类,这样可以降低学习成本。看了很多教程和文档,写下我自己听课和总结的安装方式希望对你有帮助。

查看是否安装

使用whereis命令查看

  1. [root@zjt-baidu ~]# whereis php php: /usr/bin/php /usr/lib64/php /etc/php.ini /etc/php.d /usr/local/bin/php /usr/local/lib/php /usr/include/php /usr/local/php /usr/share/php /usr/share/man/man1/php.1.gz [root@zjt-baidu ~]# /usr/bin/php -v PHP 7.2.27 (cli) (built: Jan 26 2020 15:49:49) ( NTS ) Copyright (c) 1997-2018 The PHP Group Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies

image.png

[root@zjt-baidu rpm]# yum list installed | grep php Repodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast php72w-cli.x86_64 7.2.27-1.w7 @webtatic php72w-common.x86_64 7.2.27-1.w7 @webtatic php72w-xml.x86_64

在看下是否启动
Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 127.0.0.1:9000 0.0.0.0: LISTEN 29861/php-fpm: mast tcp 0 0 0.0.0.0:6379 0.0.0.0: LISTEN 25792/redis-server

image.png

[root@ conf.d]# ps axf | grep ‘php’ 29861 ? Ss 34:54 php-fpm: master process (/usr/local/php/etc/php-fpm.conf) grep —color=auto php

一、源码安装,需要编译(比如c、go语言编写的软件)

  • 下载源码包(一般都是压缩包tar.gz)
  • 解压缩
  • 进入源码包目录
  • ./config
  • make
  • make install

By default, make install' will install all the files in/usr/local/bin’, /usr/local/lib' etc. You can specify an installation prefix other than/usr/local’ using --prefix', for instance—prefix=$HOME’.

安装完毕后启动
1、直接输入绝对路径比如
/usr/local/nginx/sbin/nginx

2、添加bin目录到PATH中

  1. cat ~/.bash_profile #
  2. # Get the aliases and functions if [ -f ~/.bashrc ]; then . ~/.bashrc fi # User specific environment and startup programs PATH=$PATH:$HOME/bin PATH=$PATH:/usr/local/php/bin/
  3. export PATH

修改完.bash_profile后执行

source .bash_profile

二、yum或者二进制文件rpm (比如c、go语言编写的软件)

2.1、rpm方式

  1. - 下载rpm包(比如mysql)
  2. - rpm -i xxx.rpm

2.2、yum方式

1、安装yum源(可以跳过)
2、yum install xxxx

三、下载,并启动

许多java或者python的程序,下载和直接启动

Java

java -jar aaa.jar
如果后台启动
nohup java -jar aaa.jar &
都有哪些选项呢?
python
4、创建软连接

  1. ln -s /usr/software/nodejs/bin/npm /usr/local/bin/ ln -s /usr/software/nodejs/bin/node /usr/local/bin/

四、启动和停止

systemctl

service