暑期记录
本周学习
MySQL安装
使用yum安装所需软件包
[root@localhost ~]# yum -y install wget
[root@localhost ~]# yum -y install httpd
通过使用wget链接网址下载所需要MySQL的软件包
[root@localhost ~]# cd /usr/local/src/
[root@localhost src]#wget http://mirrors.sohu.com/mysql/MySQL-5.6/mysql-5.6.35-linux-glibc2.5-x86_64.tar.gz
[root@localhost src]# ls
mysql-5.6.43-linux-glibc2.12-x86_64.tar.gz
解压软件包
[root@localhost src]# tar -zxvf mysql-5.6.43-linux-glibc2.12-x86_64.tar.gz
将数据转移到 /usr/local/mysql目录下 存放数据信息
[root@localhost src]# mv mysql-5.6.43-linux-glibc2.12-x86_64 /usr/local/mysql
建立MySQL的用户
[root@localhost mysql]# useradd -s /sbin/nologin mysql
初始化一个数据库,首先定义一个存放数据信息的一个目录,并赋予一定权限
[root@localhost mysql]# mkdir -p /data/mysql ; chown -R mysql:mysql /data/mysql
[root@localhost mysql]# ls -la /data/mysql
总用量 0
drwxr-xr-x. 2 mysql mysql 6 7月 22 14:24 .
drwxr-xr-x. 3 root root 19 7月 22 14:24 …
执行脚本,安装MySQL,由于该脚本是Perl脚本 所以要安装Perl环境
[root@localhost mysql]# yum -y install perl-Install-Module
7.5 7.6没有包 分歧点
User 定义所属组 datadir定义安装在哪里
[root@localhost mysql]# ./scripts/mysql_install_db --user=mysql --datadir=/data/mysql
出现了两个OK,继续操作,看后续是否成功,不成功便返回快照(待定)
将配置信息复制到etc下的my.cnf内
[root@localhost mysql]# cp support-files/my-default.cnf /etc/my.cnf
修改该配置文件
[root@localhost mysql]# vi /etc/my.cnf
basedir = /usr/local/mysql
datadir = /data/mysql
port = 3306
server_id = 30
socket = /tmp/mysql.sock
将启动脚本拷贝到/etc/init.d下命名mysqld
[root@localhost mysql]# cp support-files/mysql.server /etc/init.d/mysqld
修改启动脚本
[root@localhost mysql]# vim /etc/init.d/mysqld
basedir=/usr/local/mysql
datadir=/data/mysql
加入到系统启动项并设置为开机自启
[root@localhost mysql]# chkconfig --add mysqld
[root@localhost mysql]# chkconfig mysqld on
启动数据库
[root@localhost mysql]# service mysqld start
Starting MySQL.Logging to ‘/data/mysql/localhost.localdomain.err’.
… SUCCESS!
安装Apache(即httpd)
将安装包导入(或下载)后,解压
[root@localhost src]# tar -zxvf httpd-2.4.39.tar.gz
[root@localhost src]# tar -zxvf apr-util-1.6.1.tar.gz
[root@localhost src]# tar -zxvf apr-1.6.5.tar.gz
进入目录
[root@localhost src]# cd apr-1.6.5
编译
[root@localhost apr-1.6.5]# ./configure --prefix=/usr/local/apr
configure:5419: error: no acceptable C compiler found in $PATH
缺少gcc套件
[root@localhost src]#yum insall -y gcc
[root@localhost apr-1.6.5]# yum -y install libtool*
[root@localhost apr-1.6.5]# make && make install时缺少libtool数据库(干净的、新的系统)
[root@localhost src]# cd apr-util-1.6.1
[root@localhost apr-util-1.6.1]# ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
[root@localhost apr-util-1.6.1]# make && make install
xml/apr_xml.c:35:19: 致命错误:expat.h:没有那个文件或目录
#include <expat.h>
^
编译中断。
make[1]: *** [xml/apr_xml.lo] 错误 1
make[1]: 离开目录“/usr/local/src/apr-util-1.6.1”
make: *** [all-recursive] 错误 1
安装
[root@localhost apr-util-1.6.1]# yum install -y expat-devel
[root@localhost apr-util-1.6.1]# echo $?
0
说明安装成功
[root@localhost httpd-2.4.39]# ./configure \
–perfix=/usr/local/apache2.4
–with-apr=/usr/local/apr
–with-apr-util=/usr/local/apr-util
–enable-so
–enable-mods-shared=most
configure: error: unrecognized option: --perfix=/usr/local/apache2.4' Try
./configure --help’ for more information
缺少prce-devel包
[root@localhost apr-util-1.6.1]# yum install -y pcre-devel
[root@localhost httpd-2.4.39]# echo $?
0
返回值为0 安装成功
[root@localhost httpd-2.4.39]# make -j4 && make install
报错 未找到所需文件
[root@localhost httpd-2.4.39]# cd srclib/
[root@localhost srclib]# ls
Makefile Makefile.in
[root@localhost srclib]# cat Makefile
top_srcdir = /usr/local/src/httpd-2.4.39
top_builddir = /usr/local/src/httpd-2.4.39
srcdir = /usr/local/src/httpd-2.4.39/srclib
builddir = /usr/local/src/httpd-2.4.39/srclib
VPATH = /usr/local/src/httpd-2.4.39/srclib
BUILD_SUBDIRS = $(AP_BUILD_SRCLIB_DIRS)
CLEAN_SUBDIRS = $(AP_CLEAN_SRCLIB_DIRS)
include $(top_builddir)/build/rules.mk
[root@localhost srclib]# cd …/…/
[root@localhost src]# cp -r apr-1.6.5 httpd-2.4.39/srclib/apr
[root@localhost src]# cp -r apr-util-1.6.1 httpd-2.4.39/srclib/apr-util
[root@localhost src]# cd httpd-2.4.39
[root@localhost httpd-2.4.39]# make -j4 && make install
collect2: error: ld returned 1 exit status
collect2: error: ld returned 1 exit status
make[2]: *** [logresolve] 错误 1
make[2]: *** [htdbm] 错误 1
make[2]: 离开目录“/usr/local/src/httpd-2.4.39/support”
make[1]: *** [all-recursive] 错误 1
make[1]: 离开目录“/usr/local/src/httpd-2.4.39/support”
make: *** [all-recursive] 错误 1
[root@localhost httpd-2.4.39]# make clean
[root@localhost httpd-2.4.39]# ./configure --prefix=/usr/local/apache2.4 --enable-so --with-pcre --with-included-apr --enable-modules=most --enable-mpms-shared=all --with-mpm=prefork
安装成功
[root@localhost httpd-2.4.39]# echo $?
0
[root@localhost httpd-2.4.39]# cd /usr/local/
[root@localhost httpd-2.4.39]# cd /usr/local/
[root@localhost local]# cd apache2.4/
[root@localhost apache2.4]# s
-bash: s: 未找到命令
[root@localhost apache2.4]# du -sh
42M .
[root@localhost apache2.4]# cd …
[root@localhost local]# du -sh apache2.4/
42M apache2.4/
[root@localhost local]# cd apache2.4/
[root@localhost apache2.4]# ls
bin cgi-bin error icons lib man modules
build conf htdocs include logs manual
[root@localhost apache2.4]# cd htdocs/
[root@localhost htdocs]# ls
index.html
[root@localhost htdocs]# cat index.html
It works!
[root@localhost htdocs]# cd .. [root@localhost apache2.4]# /usr/local/apache2.4/bin/httpd -M AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain. Set the 'ServerName' directive globally to suppress this message Loaded Modules: core_module (static) so_module (static) http_module (static) mpm_prefork_module (shared) authn_file_module (shared) authn_core_module (shared) authz_host_module (shared) authz_groupfile_module (shared) authz_user_module (shared) authz_core_module (shared) access_compat_module (shared) auth_basic_module (shared) reqtimeout_module (shared) filter_module (shared) mime_module (shared) log_config_module (shared) env_module (shared) headers_module (shared) setenvif_module (shared) version_module (shared) unixd_module (shared) status_module (shared) autoindex_module (shared) dir_module (shared) alias_module (shared)安装PHP
[root@localhost src]# tar -zxvf php-5.6.30.tar.gz
[root@localhost src]# useradd -s /sbin/nologin php-fpm
[root@localhost php-5.6.30]# ./configure --prefix=/usr/local/php-fpm --with-config-file-path=/usr/local/php-fpm/etc --enable-fpm --with-fpm-user=php-fpm --with-fpm-group=php-fpm --with-mysql=/usr/local/mysql --with-mysql-sock=/tmp/mysql.sock --with-libxml-dir --with-gd --with-jpeg-dir --with-freetype-dir --with-iconv-dir --with-zlib-dir --with-mcrypt --enable-soap --enable-ftp --enable-mbstring --enable-exif --disable-ipv6 --with-pear --with-curl --with-openssl
configure: error: xml2-config not found. Please check your libxml2 installation.(配置:错误:找不到xml2配置。请检查libxml2安装。)
解决办法
[root@localhost php-5.6.30]# yum -y install libcurl-devel
[root@localhost php-5.6.30]# yum install -y bzip2 bzip2-devel libpng libpng-devel openssl openssl-devel opel-release
[root@localhost php-5.6.30]# yum install -y libxml2-devel
If configure fails try --with-vpx-dir=
configure: error: jpeglib.h not found.
[root@localhost php-5.6.30]# yum install libjpeg libpng freetype libjpeg-devel libpng-devel freetype-devel -y
yum install -y epel-release
yum install -y libmcrypt-devel
失败的软件包是:libsss_nss_idmap-1.16.0-19.el7_5.8.x86_64 GPG 密钥配置为:http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
运行下面这句话,更新检索密钥:
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
configure: error: jpeglib.h not found.
配置:错误:找不到jpeglib.h。
yum install libjpeg libpng freetype libjpeg-devel libpng-devel freetype-devel -y
configure: error: Cannot find OpenSSL’s <evp.h>
配置:错误:找不到OpenSSL的<evp.h>
[root@localhost php-5.6.30]# yum install -y openssl-devel
configure: error: mcrypt.h not found. Please reinstall libmcrypt.
配置:错误:找不到mcrypt.h。请重新安装libmcrypt。
[root@localhost php-5.6.30]# yum install -y libmcrypt-deve
[root@localhost php-5.6.30]#make -j4 && make install
[root@localhost php-5.6.30]# cp php.ini-production /usr/local/php-fpm/etc/php.ini
[root@localhost php-5.6.30]# vi /usr/local/php-fpm/etc/php-fpm.conf
[global]
pid = /usr/local/php-fpm/var/run/php-fpm.pid
error_log = /usr/local/php-fpm/var/log/php-fpm.log
[www]
listen = /tmp/php-fcgi.sock
listen.mode = 666
user = php-fpm
group = php-fpm
pm = dynamic
pm.max_children = 50
pm.start_servers = 20
pm.min_spare_servers = 5
pm.max_spare_servers = 35
pm.max_requests = 500
rlimit_files = 1024
[root@localhost php-5.6.30]# /usr/local/php-fpm/sbin/php-fpm -t
[root@localhost sapi]# cp /usr/local/src/php-5.6.30/sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
vim /usr/local/apache2.4/conf/httpd.conf
(php安装目前仍有错误未排除)
本文地址:https://blog.csdn.net/qq_45982093/article/details/107596795
上一篇: 第一天MySQL