1、CentOS7学习笔记Apache 运行账号daemonMysql账号Root:123179Cacti:123179Cacti系统账号:cactiuser:123179(给rrd logs权限的账号,cron的运行账号)Cacti登录账号:admin:123179Nagios账号:Nagios系统账号:nagios, 组:nagios, nagcmdNagios WEB access账号:nagiosadmin:123179CentOS7源码安装apache错误:apr/apr-util1.下载apr/apr-util,解压至apache(httpd)目录./httpd-2.4-XX/srcl
2、ib,将arp/arp-util后缀中的数字去掉2.重新编译./httpd-2.4-XX/configure -prefix=/usr/local/apache2 -with-included-apr错误:pcre1.从pcre.org下载pcre,解压,编译,安装 ./pcre-xxx/configure -prefix=/usr/loca/pcre;make;make install2.重新编译./httpd-2.4-XX/configure -prefix=/usr/local/apache2 -with-included-apr -with-pcre=/usr/local/pcre错误
3、:gcc/gcc-c+1. sudo yum install gcc gcc-c+经验:安装系统开机启动服务1. /usr/lib/systemd/system (需要用户登录才启动的:/usr/lib/systemd/user)2. sudo vim /usr/lib/systemd/system/apache2.service3. UnitDescription= Apache2 http server servicesServiceType=forkingExecStart=/usr/local/apache2/bin/apachectl startExecReload=/usr/loc
4、al/apache2/bin/apachectl restartExecStop=/usr/local/apache2/bin/apachectl stopPrivateTmp=trueInstallWantedBy=multi-user.target4. chmod 754 apache2.service5. sudo systemctl enable/disable apache2.service6. sudo systemctl start/stop/restart apache2.service经验:CentOS7关闭默认防火墙sudo systemctl stop firewalld
5、.service或者放开防火墙端口Sudo firewall-cmd -permanent add-port=80/tcp错误:图形界面开机后could not apply the stored configurationrm f /.config/monitors.xmlCentOS7源码安装mysql经验:准备条件make, cmake, gcc-c+错误:FATAL ERROR: please install the following Perl modules before executing ./mysql_install_db:1.sudo yum install perl-Mod
6、ule-Install错误:Could NOT find Curses (missing: CURSES_LIBRARY CURSES_INCLUDE_PATH) CMake Error at cmake/readline.cmake:85 (MESSAGE): Curses library not found. Please install appropriate package, remove CMakeCache.txt and rerun cmake.On Debian/Ubuntu, package name is libncurses5-dev, on Redhat and der
7、ivates it is ncurses-devel.1. yum install ncurses-devel2. 删除CMakeCache.txt继续运行cmake .错误:CMake Error at info_macros.cmake:110 (FILE): file Internal CMake error when trying to open file: /home/osborn.lee/Downloads/mysql-5.6.26/Docs/INFO_BIN for writing.Call Stack (most recent call first): cmake/info_b
8、in.cmake:29 (CREATE_INFO_BIN)make2: * CMakeFiles/INFO_BIN Error 1make1: * CMakeFiles/INFO_BIN.dir/all Error 2make: * all Error 21.yum -y install gcc gcc-c+ autoconf automake zlib* fiex* libxml* ncurses-devel libmcrypt* libtool-ltdl-devel* cmake cmake-gui libaio-devel bison-devel make错误:写入失败mysqld_sa
9、fe Logging to /usr/local/mysql/data/CentOS7.err.1 修改data目录权限chown R mysql data经验:修改mysql root账户密码1 #mysqladmin u root password “NEWPASSWORD” #在centos7上不成功2 #mysqladmin u root p Mysqlset password for rootlocalhost =password(NEWPASSWORD);3 #mysqladmin u root p Mysqlupdate mysql.user set password=passw
10、ord(NEWPASSWORD) where user=root; Mysqlflush privileges;经验:启动mysql(开机启动mysql)1 启动/关闭mysql#/usr/local/mysql/bin/mysqld_safe user=mysql/usr/local/mysql/bin/mysqladmin shutdown可以将/usr/local/mysql/bin加入系统路径中a 在/etc/profile加入PATH=/usr/local/mysql/bin:$PATHb 重启系统或者刷新配置立即生效#source /etc/profile2 使用mysql.s
11、erver命令#/usr/local/mysql/support-files/mysql.server start#/usr/local/mysql/support-files/mysql.server stop3 开机自动启动mysql在/usr/lib/systemd/system/中创建mysql.service文件,内容如下:UnitDescription=MySQL Community ServerAfter=network.targetInstallWantedBy=multi-user.targetServiceUser=mysqlGroup=mysqlPermissionsSt
12、artOnly=true#ExecStartPre=/usr/share/mysql/mysql-systemd-start preExecStart=/usr/local/mysql/bin/mysqld_safe -user=mysqlExecStop=/usr/local/mysql/bin/mysqladmin shutdown#ExecStartPost=/usr/share/mysql/mysql-systemd-start postTimeoutSec=600Restart=on-failurePHP源码安装错误:configure: error: Cannot find Ope
13、nSSLs 1 sudo yum install php php-devel错误:error: Please reinstall the BZip2 distribution1 sudo yum install bzip2 bzip2-devel编译PHP5.5.6时安装mcrypt2.6.8 (2013-11-20 16:52:44)转载标签: mcrypt mhash libmcrypt ld_library_path libmhash it 分类: Linux按顺序安装下列库:1. libmcrypt 2.5.82. mhash 0.9.9.93. mcrypt 2.6.8问题出在安装
14、mcrypt 2.6.8 的时候, 编译时报错:checking for mhash_keygen in -lmhash. noconfigure: error: You need at least libmhash 0.8.15 to compile this program.在安装mcrypt之前先配置路径#export LD_LIBRARY_PATH=/usr/local/libmcrypt/lib:/usr/local/mhash/lib#export LDFLAGS=-L/usr/local/mhash/lib/ -I/usr/local/mhash/include/#export
15、CFLAGS=-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
16、/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/
17、etc/php.d -with-bz2 -enable-sockets -with-snmp=/usr/local/net-snmp安装rrdtool错误:libpng pangocairo 1 yum install libpng-devel libpng-static2 yum install pango-devel cairo-develUseradd cactiuser s /sbin/nologincrontab -u cactiuser -e*/1 * * * * /usr/local/php5/bin/php /usr/local/apache/htdocs/cacti/poll
18、er.php /dev/null 2&1crontab u cactiuser l安装nagios错误:Not running 以及cgi不执行Httpd.conf启用:LoadModule cgid_module modules/mod_cgid.soNCPA as it is using a non-standard port (5693)Windows测试:https:/localhost:5693/api/?token=public./check_nrpe -H 10.16.93.229 -c alias_cpuPDQ DeployNpre port:5666NSCLIENT+使用自定
19、义脚本/settings/external scripts/scriptscheck_py = cmd /c scriptspythoncheck_py.pyNRPE使用自定义脚本rootnhserver1 libexec# vim /usr/local/nagios/etc/nrpe.cfgcommandnh_check_getload=/usr/local/nagios/libexec/getload.pyIcinga安装1 # rpm -import http:/packages.icinga.org/icinga.key# curl -o /etc/yum.repos.d/ICINGA
20、-release.repo http:/packages.icinga.org/epel/ICINGA-release.repo# yum makecacheRHEL/CentOS 7 and Fedora:# yum install icinga2# systemctl enable icinga2# systemctl start icinga2下载单个文件,默认将输出打印到标准输出中(STDOUT)中curl http:/www.centos.org通过-o/-O选项保存下载的文件到指定的文件中:-o:将文件保存为命令行中指定的文件名的文件中-O:使用URL中默认的文件名保存文件到本地1
21、 # 将文件下载到本地并命名为mygettext.html2 curl -o mygettext.html http:/www.gnu.org/software/gettext/manual/gettext.html34 # 将文件保存到本地并命名为gettext.html5 curl -O http:/www.gnu.org/software/gettext/manual/gettext.html# icinga2 feature list1 安装icinga-web1)安装mysql, centos7之后用mariadb替代mysql,maria是mysql的一个分支,防止orcal对my
22、sql进行闭源的风险。# yum install icinga2-ido-mysqlSetting up the MySQL databaseSet up a MySQL database for Icinga 2:# mysql -u root -pmysql CREATE DATABASE icinga; GRANT SELECT, INSERT, UPDATE, DELETE, DROP, CREATE VIEW, INDEX, EXECUTE ON icinga.* TO icingalocalhost IDENTIFIED BY 123179;After creating the d
23、atabase you can import the Icinga 2 IDO schema using the following command:# mysql -u root -p icinga /usr/share/icinga2-ido-mysql/schema/mysql.sql2)Enabling the IDO MySQL moduleThe package provides a new configuration file that is installed in/etc/icinga2/features-available/ido-mysql.conf. You will
24、need to update the database credentials in this file.All available attributes are explained in theIdoMysqlConnection objectchapter.You can enable theido-mysqlfeature configuration file usingicinga2 feature enable:# icinga2 feature enable ido-mysqlModule ido-mysql was enabled.Make sure to restart Ici
25、nga 2 for these changes to take effect.After enabling the ido-mysql feature you have to restart Icinga 2:Debian/Ubuntu, RHEL/CentOS 6 and SUSE:# service icinga2 restartRHEL/CentOS 7 and Fedora:# systemctl restart icinga23)Setting Up External Command PipeWeb interfaces and other Icinga addons are abl
26、e to send commands to Icinga 2 through the external command pipe.You can enable the External Command Pipe using the CLI:# icinga2 feature enable command4)By default the command pipe file is owned by the groupicingacmdwith read/write permissions. Add your webservers user to the groupicingacmdto enabl
27、e sending commands to Icinga 2 through your web interface:# usermod -a -G icingacmd daemon daemon 是apache2的运行账户,这里可以是其它用户自定义的账户,请注意查看。You can verify that the user has been successfully added to theicingacmdgroup using theidcommand:$ id git clone git:/git.icinga.org/icingaweb2.gitmv icingaweb2 /usr/s
28、hare/icingaweb2./bin/icingacli setup config webserver apache -document-root /usr/local/icingaweb2/public /usr/local/apache2/conf/extra/icingaweb2.confPHP Fatal error: Call to undefined function IcingaUtilbindtextdomain() in /usr/local/icingaweb2/library/Icinga/Util/Translator.php on line 158安装gettex
29、t,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(以上两个命令的路径根据自己系统情况而定)makemake install3、在php.ini里添加上gettext.soextension = gettext.so重启php即可extens
30、ion=/usr/local/php5/lib/php/extensions/no-debug-zts-20131226/gettext.so在/usr/local/apache2/conf/http.conf中启用icingaweb2.confInclude conf/extra/icingaweb2.conf5)rootCentOS7 icingaweb2# groupadd -r icingaweb2rootCentOS7 icingaweb2# usermod -a -G icingaweb2 daemon6)Useicingaclito create the configuratio
31、n directory which defaults to/etc/icingaweb2:./bin/icingacli setup config directoryWhen using the web setup you are required to authenticate using a token. In order to generate a token use theicingacli:./bin/icingacli setup token createIn case you do not remember the token you can show it using theicingacli:./bin/icingacli setup
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1