基于CentOS6.7编译安装LAMP

一、所需软件下载

测试机环境为:

wKiom1i2nyGScuHeAABOZAtwlbQ536.jpg

Httpd2.4 下载:http://mirrors.cnnic.cn/apache//httpd/httpd-2.4.25.tar.bz2

Apr 下载http://mirrors.hust.edu.cn/apache//apr/apr-1.5.2.tar.bz2

Apr-util 下载

http://mirrors.hust.edu.cn/apache//apr/apr-util-1.5.4.tar.bz2

Mariadb 10.1.21 下载https://downloads.mariadb.org/ 官网下载目前不知道什么原因下载不了,需要通过特殊渠道(你懂得)来获取最新的软件。

php5.6.30 下载:http://php.net/get/php-5.6.30.tar.bz2/from/a/mirror

目前最新版已到7.1.2还是保守一点选择了5.6的版本。编译php时会依赖到其他的包,所以提前通过yum 安装

yuminstalllibxml2-develbzip2-devellibmcrypt-y

Xcache php加速工具 下载:http://xcache.lighttpd.net/pub/Releases/3.2.0/xcache-3.2.0.tar.gz

编译xcache 需要依赖的包有m4和autoconf两个包

yuminstallm4autoconf-y

phpmyadmin 下载:

https://files.phpmyadmin.net/phpMyAdmin/4.6.6/phpMyAdmin-4.6.6-all-languages.zip


二、httpd安装


centos6.7中安装的apr版本较低编译httpd2.4所需较新的版本而直接通过yum升级系统现有版本apr包时可能会将其他依赖此程序包的软件,因为apr的升级造成无法启动,所以保险起见自己手动编译新版本。

1apr安装

~]#tar�Cjxfapr-1.5.2.tar.bz2�CC/usr/local/src
~]#tar�Cjxfapr-util-1.5.4.tar.bz2�CC/usr/local/src
~]#cd/usr/local/src/apr-1.5.2
~]#./confirure�Cprefix=/usr/local/apr
~]#make&&makeinstall#apr安装完成
~]#cd/usr/local/src/apr-util-1.5.4
~]#./configure�Cprefix=/usr/local/apr-util�Cwith-apr=/usr/local/apr#with-apr参数指定编译apr-util时所依赖的程序包,如不指定则编译时会查找系统默认的安装路径去查找。
~]#make&&makeinstall

很多人都会有疑问apr到底有什么作用,为什么每次编译都要用到这个包?

APR(Apache portable Run-time librariesApache可移植运行库)的目的如其名称一样,主要为上层的应用程序提供一个可以跨越多操作系统平台使用的底层支持接口库。

APR最大的作用就是socket调度。

2httpd安装

将下载的httpd-2.4.25解压至/usr/local/src目录中

~]#tar�Cjxfhttpd-2.4.25.tar.bz2�CC/usr/local/src
~]#cd/usr/local/src/httpd-2.4.25
~]#./configure�Cprefix=/usr/local/apache�Csysconfdir=/etc/apache�Cenable-so�Cenable-ssl�Cenable-cgi�Cenable-rewrite�Cwith-zlib�Cwith-pcre�Cwith-apr=/usr/local/apr�Cwith-apr-util=/usr/local/apr-util�Cenable-modules=most�Cenable-mpms-shared=all�Cwith-mpm=prefork
~]#make�Cj4&&makeinstall
#安装完成之后进行启动前配置,添加启动用户和组
~]#groupadd�Cr�Cg80apache
~]#useradd�Cr�Cgapache�Cu80apache
#为apache提供服务脚本
~]#vim/etc/rc.d/init.d/apache
#!/bin/bash
#
#httpdStartupscriptfortheApacheHTTPServer
#
#chkconfig:-8515
#description:ApacheisaWorldWideWebserver.Itisusedtoserve\
#HTMLfilesandCGI.
#processname:httpd
#config:/etc/httpd/conf/httpd.conf
#config:/etc/sysconfig/httpd
#pidfile:/var/run/httpd.pid

#Sourcefunctionlibrary.
./etc/rc.d/init.d/functions

if[-f/etc/sysconfig/httpd];then
./etc/sysconfig/httpd
fi

#StarthttpdintheClocalebydefault.
HTTPD_LANG=${HTTPD_LANG-"C"}

#Thiswillpreventinitlogfromswallowingupapass-phrasepromptif
#mod_sslneedsapass-phrasefromtheuser.
INITLOG_ARGS=""

#SetHTTPD=/usr/sbin/httpd.workerin/etc/sysconfig/httpdtouseaserver
#withthethread-based"worker"MPM;BEWARNEDthatsomemodulesmaynot
#workcorrectlywithathread-basedMPM;notablyPHPwillrefusetostart.

#Pathtotheapachectlscript,serverbinary,andshort-formformessages.
apachectl=/usr/local/apache/bin/apachectl
httpd=${HTTPD-/usr/local/apache/bin/httpd}
prog=httpd
pidfile=${PIDFILE-/var/run/httpd.pid}
lockfile=${LOCKFILE-/var/lock/subsys/httpd}
RETVAL=0

start(){
echo-n$"Starting$prog:"
LANG=$HTTPD_LANGdaemon--pidfile=${pidfile}$httpd$OPTIONS
RETVAL=$?
echo
[$RETVAL=0]&&touch${lockfile}
return$RETVAL
}

stop(){
echo-n$"Stopping$prog:"
killproc-p${pidfile}-d10$httpd
RETVAL=$?
echo
[$RETVAL=0]&&rm-f${lockfile}${pidfile}
}
reload(){
echo-n$"Reloading$prog:"
if!LANG=$HTTPD_LANG$httpd$OPTIONS-t>&/dev/null;then
RETVAL=$?
echo$"notreloadingduetoconfigurationsyntaxerror"
failure$"notreloading$httpdduetoconfigurationsyntaxerror"
else
killproc-p${pidfile}$httpd-HUP
RETVAL=$?
fi
echo
}

#Seehowwewerecalled.
case"$1"in
start)
start
;;
stop)
stop
;;
status)
status-p${pidfile}$httpd
RETVAL=$?
;;
restart)
stop
start
;;
condrestart)
if[-f${pidfile}];then
stop
start
fi
;;
reload)
reload
;;
graceful|help|configtest|fullstatus)
$apachectl$@
RETVAL=$?
;;
*)
echo$"Usage:$prog{start|stop|restart|condrestart|reload|status|fullstatus|graceful|help|configtest}"
exit1
esac

exit$RETVAL
~]#chmod+x/etc/rc.d/init.d/apache
~]#chkconfig�Caddapache
~]#serviceapachestart#测试启动是否成功

默认情况下系统防火墙会将80端口禁止通信,网上好多编译安装时,为了方便都会将防火墙关闭,我觉得生产环境中关闭防火墙毕竟不太安全,估计也没人这么干,现在就将用到的80端口以及mariadb和php用到的3306、9000端口都开放。

~]#iptables�CIINPUT�Cpctp�Cmmultiport�Cdports80,8080,3306,9000�Cmstate�CstateNEW,ESTABLISHED�CjACCEPT
#注:防火墙策略一般是自上而下审核,所以为了避免与其他策略冲突,直接将此条策略加入到最上方。
~]#setenforce0#设置selinux为Permissive模式,后续可能会将htdocs目录指向其他路径,如果不设为Permissive会无法访问。

最后在浏览器中填入测试机的IP地址,配置成功会有以下显示。

wKioL1i2oajSiqy1AABA_5B4MaE113.jpg

三、mariadb安装


首先将mysql用户mysql组。

~]#groupadd�Cr�Cg36mysql
~]#useradd�Cr�Cgmysql�Cu36mysql

此处使用的是二进制格式的程序包,解压至特定路径后简单配置后即可使用。

在生产环境当中数据库文件会单独存放在一个较大的空间当中,在此测试机中模拟有两块硬盘,在两块硬盘当中各划分出50G的空间来组成逻辑卷来存放数据文件,下边就来进行具体操作。

~]#yuminstalllvm2#此步如果系统中已安装lvm管理工具可跳过
~]#pvcreate/dev/sd{a,b}3#将硬盘a,b中的分区添加到物理卷
~]#vgcreate�Cs16Mdatavg/dev/sd{a,b}3#将物理卷中的两块物理卷加入到datavg物理卷组中
~]#lvcreate�CL50G�Cnmarialvdatavg#将物理卷组中分出50G空间来创建marialv逻辑卷
~]#mkfs�Ctext4�Cm1�CL“mariadata”�Cb2048/dev/datavg/marialv#格式化marialv逻辑卷
~]#mount/dev/datavg/marialv/data/
~]#mkdir/data/mariadb�Cp#创建数据存放路径
~]#chownmysq:mysql/data/mariadb#更改mariadb目录的属组属主为mysql
#至此数据存放位置准备完毕,如果需要开机挂载此目录则需要修改/etc/fstab文件
~]#tar�Czxfmariadb-10.1.21-linux-x86_64.tar.gz�CC/usr/local
~]#cd/usr/local
~]#ln�Csmariadb-10.1.21mysql#默认安装配置都要mysql目录中,所以需要将解压后的数据库做一个链接,也方便日后数据库升级,直接将链接更新即可。
~]#cdmysql
~]#chown�CRroot:mysql./*#将程序包中的所有文件属主属组修改为root用户mysql组
~]#scripts/mysql_install_db--datadir=/data/mariadb�Cuser=mysql#此步骤需要注意,mysql_install_db只能在scripts目录中执行,执行完毕之后如果不出意外安装完成了o(�s□�t)o

先不要急着运行,后续还要有点小调整,因为mariadb还木有配置文件和启动脚本呢!下边就来将这两项做好。

还是在mysql目录中操作,这点需要注意

mysql]#cpsupport-files/mysql.server/etc/rc.d/init.d/mysqld#添加启动脚本
mysql]#chkconfig�Caddmysqld
mysql]#mkdir/etc/mariadb
mysql]#cpsupport-files/my-larg.cnf/etc/mariadb/my.cnf
#在support-files目录中提供了三个针对不同硬件的配置文件,可以根据自己系统硬件的不同来自行选配,这里选择的是my-larg.cnf
#编辑my.cnf并添加以下三个选项
mysql]#vim/etc/mariadb/my.cnf

[client]
#password=your_password
port=3306
#socket=/tmp/mysql.sock
socket=/data/mariadb/mysql.sock

#Herefollowsentriesforsomespecificprograms
#TheMariaDBserver
[mysqld]
port=3306
socket=/data/mariadb/mysql.sock
#…省略其他不变的选项
thread_concurrency=8#这个参数可以根据自己服务器硬件配置来更改,一般为CPU个数乘以2
datadir=/data/mariadb#数据库存放路径
innodb_file_per_table=on#每个数据表存储类型都是独立的
skip_name_resolve=on#跳过数据库反向解析主机名

mysql]#bin/mysql_secure_installation#可以为root设置密码,删除匿名用户等一些操作
配置完成可以运行servicemysqldstart启动服务
~]#ss�Cnat|grep3306#可以看到端口已经启动

wKioL1i2pMWAzGMCAAAtTYVObS0031.jpg

四、PHP安装

PHP的编译安装方式可以根据httpd编译的方式不同也会有不同的编译方式,之前的httpd mpm采用了event模式编译,此处的php也采用modules模式编译。

安装之前先解决依赖关系,安装bzip2-devel、libmcrypt-devel、libxml2-devel程序开发包。

~]#yuminstallbzip-devellibmcrypt-devellibxml2-devel�Cy
~]#tar-Jxfphp-5.6.30.tar.xz-C/usr/local/src#解压到src目录中
~]#cd/usr/local/src/php-5.6.30
~]#./configure�Cprefix=/usr/local/php�Cwith-mysql=/usr/local/mysql�Cwith-openssl�Cwith-mysqli=/usr/local/mysql/bin/mysql_config�Cenable-mbstring�Cwith-freetype-dir�Cwith-jpeg-dir�Cwith-png-dir�Cwith-zlib�Cwith-libxml-dir=/usr�Cenable-xml�Cenable-sockets�Cwith-apxs2=/usr/local/apache/bin/apxs�Cwith-mcrypt�Cwith-config-file-path=/etc/php�Cwith-config-file-scan-dir=/etc/php/php.d�Cwith-bz2�Cenable-maintainer-zts#这堆参数太特么的烧脑了,背了两天o(�s□�t)o

下边来介绍下这些参数都有什么作用。

prefix:指定安装路径

with-mysql:指明依赖mysql位置

with-openssl:在依赖openssl模块时,是系统默认的安装位置时不用指定,可以自己找到。

with-mysqli:对于Mysql数据库交互的另一种接口。

enable-mbstring:启动多字节字符的支持,对于中文务必开启。

with-freetype-dir:指明字体格式,让php页面支持更多字体显示。

with-jpeg-dir:可以使用php处理jpeg格式的图片。

with-png-dir:可以使用php处理png格式的图片。

with-zlib:启动zlib压缩传输功能。

with-libxml-dir:支持处理XML格式文档。

enable-xml:xml功能

enable-sockets:启用php支持基于socket方式进行通信。

with-apxs2:指定httpd第三方模块编译工具。

with-mcrypt:支持加解密库。

with-config-file-scan-dir:指定PHP所有配置文件存放路径。

with-bz2:支持bz2加密。

enable-maintainer-zts 如果httpd编译是使用prefork模式,此项即可省略,若是使用event或worker模式编译,此参数务必添加。

php]#make�Cj4&&makeinstall
#编译完成之后使用httpd�CM即可看到php5模块已经加入到httpd中。
php]#cpphp.ini-production/etc/php/php.ini#为php添加配置文件
~]#vim/etc/apache/httpd.conf#修改httpd配置文件以让其支持php格式的文件
#查找AddType并在下边添加两条配置信息
AddTypeapplication/x-httpd-php.php
AddTypeapplication/x-httpd-php-source.phps
#查找DirectoryIndex在index.html前添加index.php
~]#serviceapachereload#httpd重读配置文件
~]#mv/usr/local/apache/htdocs/index.html/usr/local/apache/htdocs/index.php
<?php
$link=mysql_connect(‘127.0.0.1’,’testuser’,’testuser’);
If($link)
echo“Mysqlconnectsuccess!”;
else
echo“Mysqlconnecterror!”;
mysql_close();
phpinfo();
?>

在浏览器中键入测试机的IP地址,正常情况下出现此测试页面,证明安装成功!

wKiom1i2pPrCC68NAACZBue2ghM237.jpg

五、安装Xcache为PHP提速

~]#tar-zxfxcache-3.2.0.tar.gz-C/usr/local/src/
~]#cd/usr/local/src/xcache-3.2.0/
xcache-3.2.0]#/usr/local/php/bin/phpize#使用php的phpize工具生成configure编译脚本
xcache-3.2.0]#./configure�Cenable-xcache�Cwith-php-config=/usr/local/php/bin/php-config
xcache-3.2.0]#make&&makeinstall
#注:安装结束时会有以下信息:
#Installingsharedxtensions:/usr/local/php/lib/php/extensions/no-debug-non-zts-20131226
#将路径复制下来

接下来将php于xcache整合

xcache-3.2.0]#cpxcache.ini/etc/php/php.d/
xcache-3.2.0]#vim/etc/php/php.d/xcache.ini
#找到zend_extension开头的行,修改为如下行:
zend_extension=/usr/local/php/lib/php/extensions/no-debug-non-zts-20131226/xcache.so

注意:如果php.ini文件中有多条zend_extension指令行,要确保此新增的行排在第一位。

wKioL1i2pXSSiBBkAAC7zYEs9oc366.jpg

至此以modules模式安装php完成!!你以为万事大吉了???骚年你还是太年轻了,下边再来试试fcgi模式重新编译安装php!!(你以为这半个月我闲着没事干呢,哼!)

六、开始

歇会!就这么任性!还得新开一段,嘿嘿!

七、fpm模式编译安装PHP

http为了避免冲突可以重新编译一次,方法与之前相同此处不做说明,但要注意一点的是,如果要更改之前的安装路径什么的,最好要make clean一下。

下边来重新编译php:

php]#./configure�Cprefix=/usr/local/php5.6�Cwith-mysql=/usr/local/mysql�Cwith-openssl�Cwith-mysqli=/usr/local/mysql/bin/mysql_config�Cenable-mbstring�Cwith-freetype-dir�Cwith-jpeg-dir�Cwith-png-dir�Cwith-zlib�Cwith-libxml-dir=/usr�Cenable-xml�Cenable-sockets�Cenable-fpm�Cwith-mcrypt�Cwith-config-file-path=/etc/php5.6�Cwith-config-file-scan-dir=/etc/php5.6/php.d�Cwith-bz2

可以看出来fpm模式编译则不需要apxsmaintainer两个参数

php]#make�Cj4&&makeinstall
php]#cpphp.ini-production/etc/php5.6/php.ini

该方式安装的php是以独立服务的方式向外提供服务的,所以需要为其提供启动脚本和配置文件。

配置文件在编译包的sapi/fpm目录中已经存在,直接复制到/etc/rc.d/init.d目录中即可

php]#cpsapi/fpm/init.d.php-fpm/etc/rc.d/init.d/php-fpm
php]#chmod+x/etc/rc.d/init.d/php-fpm#为脚本设置执行权限
php]#chkconfig�Caddphp-fpm
php]#cp/usr/local/php5.6/etc/php-fpm.conf.default/usr/local/php5.6/etc/php-fpm.conf
#为启动脚本添加配置文件,并添加和修改配置信息
php5.6]#vim/usr/local/php5.6/etc/php-fpm.conf
pm.max_children=50
pm.start_servers=5
pm.min_spare_servers=2
pm.max_spare_servers=8
[global]
;Pidfile
;Note:thedefaultprefixis/usr/local/php/var
;DefaultValue:none
;pid=run/php-fpm.pid
pid=/usr/local/php5.6/var/run/php-fpm.pid
php配置完成启动试试
~]#servicephp-fpmstart#不出意外的话启动成功

下边配置httpd的配置选项来让其支持php格式文件

~]#vim/etc/apache/httpd.conf
#查找到mod_proxy和mod_proxy_fcgi两个模块将其注释去掉,启动该功能,
LoadModuleproxy_modulemodules/mod_proxy.so
LoadModuleproxy_fcgi_modulemodules/mod_proxy_fcgi.so

AddTypeapplication/x-httpd-php.php
AddTypeapplication/x-httpd-php-source.phps
DirectoryIndexindex.phpindex.html
#保存退出,重新载入httpd配置
~]#serviceapachereload

哦对了,还有一项特别重要的事项:fpm模式编译的Php向httpd提供服务时,此时的httpd则相当于服务器中的前端,当接收到php动态请求时则通过反向代理配置将请求送到后端Php服务器当中处理,下面来启用httpd中的虚拟机配置,并将虚拟机配置反向代理

1. httpd2.4配置虚拟主机的操作与2.2有所不同,2.4当中将虚拟主机设置为单独的模块来加载,需要启用而且要将DocumentRoot 中心主机禁用,下边贴出配置:

~]#vim/etc/apache/httpd.conf
#DocumentRoot"/usr/local/apache/htdocs"#该项注释
#Virtualhosts
Include/etc/apache/extra/httpd-vhosts.conf#将该项启用
#保存退出

2. 编辑/etc/apache/extra/httpd-vhosts.conf 虚拟主机配置文件,httpd2.4的虚拟主机都在此文件中配置

<VirtualHost*:80>
DocumentRoot"/usr/local/apache/htdocs/"
ServerNamewww.testphp.com
ErrorLog"logs/testphp.com-error_log"
CustomLog"logs/testphp.com-access_log"combined
<Directory“/usr/local/apache/htdocs”>
OptionsNone
AllowOverrideNone
<RequireAll>
Requireallgranted
<RequireAll>
ProxyRequestsOff#关闭正向代理
ProxyPassMatch^/(.*\.php)$fcgi://127.0.0.1:9000/usr/local/apache/htdocs/$1
</Directory>
</VirtualHost>

保存退出后,重新加载httpd配置

至此所有配置以全部完成,这半个多月的煎熬总算是整理完成了,后续看看将https加入到中间来,进一步扩充其中的功能,先到这吧,歇了!

wKioL1i2ptPA-o7tAAEE0GIURng246.jpg

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


linux下开机自启: 在/etc/init.d目录下新建文件elasticsearch 并敲入shell脚本: 注意, 前两行必须填写,且要注释掉。 第一行为shell前行代码,目的告诉系统使用shell。 第二行分别代表运行级别、启动优先权、关闭优先权,且后面添加开机服务会用到。 shell脚本
1、因为在centos7中/etc/rc.d/rc.local的权限被降低了,所以需要赋予其可执行权 chmod +x /etc/rc.d/rc.local 2、赋予脚本可执行权限假设/usr/local/script/autostart.sh是你的脚本路径,给予执行权限 chmod +x /usr
最简单的查看方法可以使用ls -ll、ls-lh命令进行查看,当使用ls -ll,会显示成字节大小,而ls- lh会以KB、MB等为单位进行显示,这样比较直观一些。 通过命令du -h –max-depth=1 *,可以查看当前目录下各文件、文件夹的大小,这个比较实用。 查询当前目录总大小可以使用d
ASP.NET Core应用程序发布linux在shell中运行是正常的。可一但shell关闭网站也就关闭了,所以要配置守护进程, 用的是Supervisor,本文主要记录配置的过程和过程遇到的问题 安装Supervisor&#160;1 yum install python-setuptools
设置时区(CentOS 7) 先执行命令timedatectl status|grep &#39;Time zone&#39;查看当前时区,如果不是时区(Asia/Shanghai),则需要先设置为中国时区,否则时区不同会存在时差。 #已经是Asia/Shanghai,则无需设置 [root@xia
vim&#160;/etc/sysconfig/network-scripts/ifcfg-eth0 BOOTPROTO=&quot;static&quot; ONBOOT=yes IPADDR=192.168.8.106 NETMASK=255.255.252.0 GATEWAY=192.168.
一、安装gcc依赖 由于 redis 是用 C 语言开发,安装之前必先确认是否安装 gcc 环境(gcc -v),如果没有安装,执行以下命令进行安装 [root@localhost local]# yum install -y gcc 二、下载并解压安装包 [root@localhost local
第一步 On CentOS/RHEL 6.*: $ sudo rpm -Uvh http://li.nux.ro/download/nux/dextop/el6/x86_64/nux-dextop-release-0-2.el6.nux.noarch.rpm On CentOS/RHEL 7: $
/// &lt;summary&gt; /// 取小写文件名后缀 /// &lt;/summary&gt; /// &lt;param name=&quot;name&quot;&gt;文件名&lt;/param&gt; /// &lt;returns&gt;返回小写后缀,不带“.”&lt;/ret
which nohup .bash_profile中并source加载 如果没有就安装吧 yum provides */nohup nohup npm run start &amp; nohup ./kibana &amp;
1.1 MySQL安装 1.1.1 下载wget命令 yum -y install wget 1.1.2 在线下载mysql安装包 wget https://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm 1.1.3 安装My
重启 reboot shutdown -r now init 6 关闭 init 0 shutdown -h now shutdown -h 20:25 #8点25关机查看内存 free CPU利用率 top 日期 date 设置时间 date 033017002015 #月日时间年 日历 cal
1、firewalld的基本使用 启动: systemctl start firewalld 关闭: systemctl stop firewalld 查看状态: systemctl status firewalld 开机禁用 : systemctl disable firewalld 开机启用 :
1 下载并安装MySQL官方的&#160;Yum Repository wget -i -c http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm 使用上面的命令就直接下载了安装用的Yum Repository,大概
CentOS6.x CentOS6中转用Upstrat代替以前的init.d/rcX.d的线性启动方式。 一、相关命令 通过initctl help可以查看相关命令 [root@localhost ~]# initctl help Job commands: start Start job. sto
1、使用命令:df -lk 找到已满磁盘 2、使用命令:du --max-depth=1 -h 查找大文件,删除
ifconfig:查看网卡信息 网卡配置文件位置: /etc/sysconfig/network-scripts/文件夹 nmtui:配置网卡 netstat -tlunp:查看端口信息 端口信息存储位置: /etc/services文件 route:查看路由信息 wget:下载网路文件,例如 wg
ps -ef:查看所有进程,&#160;ps -ef |grap firewalld 查看与firewalld相关的进程 which :查看进程:which firewalld kill 进程id:杀掉进程 kill 640,强制杀:kill -9 640 man:查看帮助,例如 man ps 查看
useradd:添加用户 useradd abc,默认添加一个abc组 vipw:查看系统中用户 groupadd:添加组groupadd ccna vigr:查看系统中的组 gpasswd:将用户abc添加到ccna组 gpasswd -a abc ccna groups abc:查看用户abc属