CentOS7学习笔记.docx

上传人:b****5 文档编号:4487097 上传时间:2022-12-01 格式:DOCX 页数:18 大小:510.36KB
下载 相关 举报
CentOS7学习笔记.docx_第1页
第1页 / 共18页
CentOS7学习笔记.docx_第2页
第2页 / 共18页
CentOS7学习笔记.docx_第3页
第3页 / 共18页
CentOS7学习笔记.docx_第4页
第4页 / 共18页
CentOS7学习笔记.docx_第5页
第5页 / 共18页
点击查看更多>>
下载资源
资源描述

CentOS7学习笔记.docx

《CentOS7学习笔记.docx》由会员分享,可在线阅读,更多相关《CentOS7学习笔记.docx(18页珍藏版)》请在冰豆网上搜索。

CentOS7学习笔记.docx

CentOS7学习笔记

Apache运行账号daemon

Mysql账号

Root:

123179

Cacti:

123179

Cacti系统账号:

cactiuser:

123179(给rrdlogs权限的账号,cron的运行账号)

Cacti登录账号:

admin:

123179

Nagios账号:

Nagios系统账号:

nagios,组:

nagios,nagcmd

NagiosWEBaccess账号:

nagiosadmin:

123179

 

CentOS7源码安装apache

错误:

apr/apr-util

1.下载apr/apr-util,解压至apache(httpd)目录./httpd-2.4-XX/srclib,将arp/arp-util后缀中的数字去掉

2.重新编译./httpd-2.4-XX/configure--prefix=/usr/local/apache2--with-included-apr

错误:

pcre

1.从pcre.org下载pcre,解压,编译,安装./pcre-xxx/configure--prefix=/usr/loca/pcre;make;makeinstall

2.重新编译./httpd-2.4-XX/configure--prefix=/usr/local/apache2--with-included-apr--with-pcre=/usr/local/pcre

错误:

gcc/gcc-c++

1.sudoyuminstallgccgcc-c++

经验:

安装系统开机启动服务

1./usr/lib/systemd/system(需要用户登录才启动的:

/usr/lib/systemd/user)

2.sudovim/usr/lib/systemd/system/apache2.service

3.[Unit]

Description=Apache2httpserverservices

[Service]

Type=forking

ExecStart=/usr/local/apache2/bin/apachectlstart

ExecReload=/usr/local/apache2/bin/apachectlrestart

ExecStop=/usr/local/apache2/bin/apachectlstop

PrivateTmp=true

[Install]

WantedBy=multi-user.target

4.chmod754apache2.service

5.sudosystemctlenable/disableapache2.service

6.sudosystemctlstart/stop/restartapache2.service

经验:

CentOS7关闭默认防火墙

sudosystemctlstopfirewalld.service

或者放开防火墙端口

Sudofirewall-cmd--permanent–add-port=80/tcp

错误:

图形界面开机后couldnotapplythestoredconfiguration

rm–f~/.config/monitors.xml

CentOS7源码安装mysql

经验:

准备条件make,cmake,gcc-c++

错误:

FATALERROR:

pleaseinstallthefollowingPerlmodulesbeforeexecuting./mysql_install_db:

1.sudoyuminstallperl-Module-Install

错误:

CouldNOTfindCurses(missing:

CURSES_LIBRARYCURSES_INCLUDE_PATH)

CMakeErroratcmake/readline.cmake:

85(MESSAGE):

Curseslibrarynotfound.Pleaseinstallappropriatepackage,

removeCMakeCache.txtandreruncmake.OnDebian/Ubuntu,packagenameislibncurses5-dev,onRedhatandderivatesitisncurses-devel.

1.yuminstallncurses-devel

2.删除CMakeCache.txt继续运行cmake.

错误:

CMakeErroratinfo_macros.cmake:

110(FILE):

fileInternalCMakeerrorwhentryingtoopenfile:

/home/osborn.lee/Downloads/mysql-5.6.26/Docs/INFO_BINforwriting.

CallStack(mostrecentcallfirst):

cmake/info_bin.cmake:

29(CREATE_INFO_BIN)

make[2]:

***[CMakeFiles/INFO_BIN]Error1

make[1]:

***[CMakeFiles/INFO_BIN.dir/all]Error2

make:

***[all]Error2

1.yum-yinstallgccgcc-c++autoconfautomakezlib*fiex*libxml*ncurses-devellibmcrypt*libtool-ltdl-devel*cmakecmake-guilibaio-develbison-develmake

错误:

写入失败mysqld_safeLoggingto'/usr/local/mysql/data/CentOS7.err'.

1修改data目录权限chown–Rmysqldata

经验:

修改mysqlroot账户密码

1#mysqladmin–urootpassword“NEWPASSWORD”#在centos7上不成功

2#mysqladmin–uroot–p

Mysql>setpasswordfor‘root’@’localhost’=password(‘NEWPASSWORD’);

3#mysqladmin–uroot–p

Mysql>updatemysql.usersetpassword=password(‘NEWPASSWORD’)whereuser=’root’;

Mysql>flushprivileges;

经验:

启动mysql(开机启动mysql)

1启动/关闭mysql

#/usr/local/mysql/bin/mysqld_safe–user=mysql&

#/usr/local/mysql/bin/mysqladminshutdown

可以将/usr/local/mysql/bin加入系统路径中

a在/etc/profile加入PATH=/usr/local/mysql/bin:

$PATH

b重启系统或者刷新配置立即生效#source/etc/profile

2使用mysql.server命令

#/usr/local/mysql/support-files/mysql.serverstart

#/usr/local/mysql/support-files/mysql.serverstop

3开机自动启动mysql

在/usr/lib/systemd/system/中创建mysql.service文件,内容如下:

[Unit]

Description=MySQLCommunityServer

After=network.target

[Install]

WantedBy=multi-user.target

[Service]

User=mysql

Group=mysql

PermissionsStartOnly=true

#ExecStartPre=/usr/share/mysql/mysql-systemd-startpre

ExecStart=/usr/local/mysql/bin/mysqld_safe--user=mysql

ExecStop=/usr/local/mysql/bin/mysqladminshutdown

#ExecStartPost=/usr/share/mysql/mysql-systemd-startpost

TimeoutSec=600

Restart=on-failure

PHP源码安装

错误:

configure:

error:

CannotfindOpenSSL's

1sudoyuminstallphpphp-devel

错误:

error:

PleasereinstalltheBZip2distribution

1sudoyuminstallbzip2bzip2-devel

编译PHP5.5.6时安装mcrypt2.6.8(2013-11-2016:

52:

44)

转载

标签:

mcryptmhashlibmcryptld_library_pathlibmhashit分类:

Linux

按顺序安装下列库:

1.libmcrypt2.5.8

2.mhash0.9.9.9

3.mcrypt2.6.8

问题出在安装mcrypt2.6.8的时候,编译时报错:

checkingformhash_keygenin-lmhash...no

configure:

error:

"Youneedatleastlibmhash0.8.15tocompilethisprogram.

在安装mcrypt之前先配置路径

###exportLD_LIBRARY_PATH=/usr/local/libmcrypt/lib:

/usr/local/mhash/lib

###exportLDFLAGS="-L/usr/local/mhash/lib/-I/usr/local/mhash/include/"

###exportCFLAGS="-I/usr/local/mhash/include/"

###./configure--prefix=/usr/local/mcrypt/--with-libmcrypt-prefix=/usr/local/libmcrypt

接下来的php编译参数需要添加这两项:

--with-mcrypt=/usr/local/libmcrypt

--with-mhash=/usr/local/mhash

经验:

编译php

./configure--prefix=/usr/local/php--with-mysql=/usr/local/mysql--with-openssl--with-mysqli=/usr/local/mysql/bin/mysql_config--enable-mbstring--with-freetype-dir--with-jpeg-dir--with-png-dir--with-zlib--with-libxml-dir=/usr--enable-xml--with-apxs2=/usr/local/apache2/bin/apxs--with-mcrypt=/usr/local/libmcrypt--with-config-file-path=/usr/local/php5/etc--with-config-file-scan-dir=/usr/local/php5/etc/php.d--with-bz2--enable-sockets--with-snmp=/usr/local/net-snmp

安装rrdtool

错误:

libpngpangocairo

1yuminstalllibpng-devellibpng-static

2yuminstallpango-develcairo-devel

Useraddcactiuser–s/sbin/nologin

crontab-ucactiuser-e

*/1****/usr/local/php5/bin/php/usr/local/apache/htdocs/cacti/poller.php>/dev/null2>&1

crontab–ucactiuser–l

安装nagios

错误:

Notrunning以及cgi不执行

Httpd.conf

启用:

LoadModulecgid_modulemodules/mod_cgid.so

NCPAasitisusinganon-standardport(5693)

Windows测试:

https:

//localhost:

5693/api/?

token=public

 

./check_nrpe-H10.16.93.229-calias_cpu

PDQDeploy

Npreport:

5666

NSCLIENT++使用自定义脚本

[/settings/externalscripts/scripts]

check_py=cmd/c"scripts\python\check_py.py"

NRPE使用自定义脚本

[root@nhserver1libexec]#vim/usr/local/nagios/etc/nrpe.cfg

 command[nh_check_getload]=/usr/local/nagios/libexec/getload.py

Icinga安装

1#rpm--importhttp:

//packages.icinga.org/icinga.key

#curl-o/etc/yum.repos.d/ICINGA-release.repohttp:

//packages.icinga.org/epel/ICINGA-release.repo

#yummakecache

RHEL/CentOS7andFedora:

#yuminstallicinga2

#systemctlenableicinga2

#systemctlstarticinga2

下载单个文件,默认将输出打印到标准输出中(STDOUT)中

curlhttp:

//www.centos.org

通过-o/-O选项保存下载的文件到指定的文件中:

-o:

将文件保存为命令行中指定的文件名的文件中

-O:

使用URL中默认的文件名保存文件到本地

1#将文件下载到本地并命名为mygettext.html

2curl-omygettext.htmlhttp:

//www.gnu.org/software/gettext/manual/gettext.html

3

4#将文件保存到本地并命名为gettext.html

5curl-Ohttp:

//www.gnu.org/software/gettext/manual/gettext.html

#icinga2featurelist

 

1安装icinga-web

1)安装mysql,centos7之后用mariadb替代mysql,maria是mysql的一个分支,防止orcal对mysql进行闭源的风险。

#yuminstallicinga2-ido-mysql

SettinguptheMySQLdatabase

SetupaMySQLdatabaseforIcinga2:

#mysql-uroot-p

mysql>CREATEDATABASEicinga;

GRANTSELECT,INSERT,UPDATE,DELETE,DROP,CREATEVIEW,INDEX,EXECUTEONicinga.*TO'icinga'@'localhost'IDENTIFIEDBY'123179';

AftercreatingthedatabaseyoucanimporttheIcinga2IDOschemausingthefollowingcommand:

#mysql-uroot-picinga

2)EnablingtheIDOMySQLmodule

Thepackageprovidesanewconfigurationfilethatisinstalledin/etc/icinga2/features-available/ido-mysql.conf.Youwillneedtoupdatethedatabasecredentialsinthisfile.

Allavailableattributesareexplainedinthe IdoMysqlConnectionobjectchapter.

Youcanenablethe ido-mysql featureconfigurationfileusing icinga2featureenable:

#icinga2featureenableido-mysql

Module'ido-mysql'wasenabled.

MakesuretorestartIcinga2forthesechangestotakeeffect.

Afterenablingtheido-mysqlfeatureyouhavetorestartIcinga2:

Debian/Ubuntu,RHEL/CentOS6andSUSE:

#serviceicinga2restart

RHEL/CentOS7andFedora:

#systemctlrestarticinga2

3)SettingUpExternalCommandPipe

WebinterfacesandotherIcingaaddonsareabletosendcommandstoIcinga2throughtheexternalcommandpipe.

YoucanenabletheExternalCommandPipeusingtheCLI:

#icinga2featureenablecommand

4)Bydefaultthecommandpipefileisownedbythegroup icingacmd withread/writepermissions.Addyourwebserver'susertothegroup icingacmdtoenablesendingcommandstoIcinga2throughyourwebinterface:

#usermod-a-Gicingacmddaemon

daemon是apache2的运行账户,这里可以是其它用户自定义的账户,请注意查看。

Youcanverifythattheuserhasbeensuccessfullyaddedtothe icingacmdgroupusingthe id command:

$id

gitclonegit:

//git.icinga.org/icingaweb2.git

mvicingaweb2/usr/share/icingaweb2

./bin/icingaclisetupconfigwebserverapache--document-root/usr/local/icingaweb2/public>/usr/local/apache2/conf/extra/icingaweb2.conf

PHPFatalerror:

CalltoundefinedfunctionIcinga\Util\bindtextdomain()in/usr/local/icingaweb2/library/Icinga/Util/Translator.phponline158

安装gettext,php加载gettext模块

安装php的模块有两种方式:

一、重新编译php,加上--with-gettext

二、动态安装

现在说下第二个动态安装

1、下载同版本的php原包,解压后进入ext目录,目录下便是模块

2、进入gettext目录下执行:

/usr/local/php/bin/phpize

./configure--with-php-config=/usr/local/php/bin/php-config

(以上两个命令的路径根据自己系统情况而定)

make

makeinstall

3、在php.ini里添加上gettext.so

extension="gettext.so"

重启php即可

extension=/usr/local/php5/lib/php/extensions/no-debug-zts-20131226/gettext.so

 

在/usr/local/apache2/conf/http.conf中启用icingaweb2.conf

Includeconf/extra/icingaweb2.conf

5)[root@CentOS7icingaweb2]#groupadd-ricingaweb2

[root@CentOS7icingaweb2]#usermod-a-Gicingaweb2daemon

6)

Use icingacli tocreatetheconfigurationdirectorywhichdefaultsto /etc/icingaweb2:

./bin/icingaclisetupconfigdirectory

Whenusingthewebsetupyouarerequiredtoauthenticateusingatoken.Inordertogenerateatokenusetheicingacli:

./bin/icingaclisetuptokencreate

Incaseyoudonotrememberthetokenyoucanshowitusingthe icingacli:

./bin/icingaclisetup

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 高中教育 > 高中教育

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1