MariaDB安装
准备
- 先把下载的二进制安装包,放到到指定目录 因为源网站下载速度太慢,我们这里是windos上下载好 在传到linux中去的 先从windos上把包传到linux下
# 一般下载的包 都在这里,所以传文件也指定到这里方便我们查找[root@centos001 src]# cd /usr/local/src/
1.Linux和windows互传文件 安装yum包
###用yum安装一个包 lrzsz2.从windows传文件到linux
命令rz# 选项:rz -r适用于异常状态时,如传送出错
3.解压压缩包
tar zxvf 包名
安装步骤
- 初始化
#进入目录[root@centos001 ~]# cd /usr/local/src/[root@centos001 src]# lshttpd-2.2.34 mysql-5.1.73-linux-x86_64-glibc23.tar.gzhttpd-2.2.34.tar.gz mysql-5.1.73-linux-x86_64-glibc23.tar.gz.1mariadb-10.2.6-linux-glibc_214-x86_64 mysql-5.6.36-linux-glibc2.5-x86_64.tar.gzmariadb-10.2.6-linux-glibc_214-x86_64.tar.gz# 把刚才解压好的文件 移动并创建 /usr/local/mariadb目录[root@centos001 src]# mv mariadb-10.2.6-linux-glibc_214-x86_64 /usr/local/mariadb[root@centos001 src]# ls /usr/local/mariadbbin data include mysql-test shareCOPYING DESTINATION INSTALL-BINARY README.md sql-benchCOPYING.thirdparty docs lib README-wsrep support-filesCREDITS EXCEPTIONS-CLIENT man scripts# 进入刚刚创建的目录[root@centos001 src]# cd /usr/local/mariadb# 进行初始化[root@centos001 mariadb]# ./scripts/mysql_install_db --user=mysql --basedir=/usr/local/mariadb/ --datadir=/data/mariadb#检查一下 有没有两个ok 或者看看是否生成了新的目录[root@centos001 mariadb]# ls /data/mariadb/aria_log.00000001 ib_buffer_pool ib_logfile0 mysql testaria_log_control ibdata1 ib_logfile1 performance_schema[root@centos001 mariadb]# ls /data/mysql/auto.cnf ibdata1 ib_logfile1 performance_schemacentos001.err ib_logfile0 mysql test
- 拷贝配置文件与启动脚本
[root@centos001 mariadb]# cd /usr/local/mariadb/## 这有多个配置文件 分别代表不同的大小 我们可以按照我们的需求拷贝[root@centos001 mariadb]# ls support-files/binary-configure my-innodb-heavy-4G.cnf my-small.cnf mysql.server wsrep_notifymagic my-large.cnf mysqld_multi.server policymy-huge.cnf my-medium.cnf mysql-log-rotate wsrep.cnf## 根据内存大小不同指定合适的缓存[root@centos001 mariadb]# vim support-files/my-small.cnf[root@centos001 mariadb]# free total used free shared buff/cache availableMem: 1008152 85576 146780 6876 775796 703000Swap: 2097148 40 2097108# 拷贝配置文件 为了于之前做实验的目录区分[root@centos001 mariadb]# cp support-files/my-small.cnf /usr/local/mariadb/my.cnf# 拷贝启动脚本[root@centos001 mariadb]# cp support-files/mysql.server /etc/init.d/mariadb
- 编辑配置文件与启动脚本
# 编辑启动脚本配置文件[root@centos001 mariadb]# vim /etc/init.d/mariadb# 编辑内容basedir=/usr/local/mariadbdatadir=/data/mariadbconf=$basedir/my.cnf
启动服务
[root@centos001 mariadb]# systemctl stop mysql[root@centos001 mariadb]# /etc/init.d/mariadb startReloading systemd: [ 确定 ]Starting mariadb (via systemctl): [ 确定 ]
安装Apache(源码包)
- 介绍 Apache是一个基金会的名字,httpd才是我们要安装的软件包,早期它的名字就叫apache Apache官网www.apache.org
准备
- 下载必要的源码包
#进入安装包目录[root@centos001 ~]# cd /usr/local/src/#下载地址[root@centos001 src]# wget http://mirrors.cnnic.cn/apache/httpd/httpd-2.4.29.tar.gz[root@centos001 src]# http://mirrors.cnnic.cn/apache/apr/apr-1.6.3.tar.gz[root@centos001 src]# wget http://mirrors.cnnic.cn/apache/apr/apr-util-1.6.1.tar.bz2#分别解压[root@centos001 src]# lsapr-1.6.3 httpd-2.4.29.tar.gzapr-1.6.3.tar.gz mariadb-10.2.6-linux-glibc_214-x86_64.tar.gzapr-util-1.6.1.tar.bz2 mysql-5.1.73-linux-x86_64-glibc23.tar.gzhttpd-2.2.34 mysql-5.1.73-linux-x86_64-glibc23.tar.gz.1httpd-2.2.34.tar.gz mysql-5.6.36-linux-glibc2.5-x86_64.tar.gzhttpd-2.4.29# 其中有bz2结尾的文件,可以用以下方法解开tar -xjvf apr-util-1.6.1.tar.bz2
安装
1.先安装apr[root@centos001 src]# cd apr-1.6.3/[root@centos001 apr-1.6.3]# lsapr-config.in buildconf dso libapr.rc NOTICE supportapr.dep build.conf emacs-mode LICENSE NWGNUmakefile tablesapr.dsp build-outputs.mk encoding locks passwd testapr.dsw CHANGES file_io Makefile.in poll threadprocapr.mak CMakeLists.txt helpers Makefile.win random timeapr.pc.in config.layout include memory README toolsapr.spec configure libapr.dep misc README.cmake useratomic configure.in libapr.dsp mmap shmembuild docs libapr.mak network_io strings#初始化,指定安装目录及指定已经安装apr的路径[root@centos001 apr-1.6.3]# ./configure --prefix=/usr/local/apr#怕出错就检查一下[root@centos001 apr-1.6.3]# echo $?02.安装apr-util[root@centos001 src]# cd apr-util-1.6.1[root@centos001 apr-util-1.6.1]# ./configure --prefix=/usr/local/apr-util --with-apr=/usr/
错误1:安装apr-util出错
[root@centos001 apr-util-1.6.1]# make && make installxml/apr_xml.c:35:19: 致命错误:expat.h:没有那个文件或目录 #include^编译中断。make[1]: *** [xml/apr_xml.lo] 错误 1make[1]: 离开目录“/usr/local/src/apr-util-1.6.1”make: *** [all-recursive] 错误 1
解决方法:下载这个包
[root@centos001 apr-util-1.6.1]# yum install -y expat-devel
继续安装
#重新执行这个命令[root@centos001 apr-util-1.6.1]# make && make install3.安装httpd[root@centos001 src]# cd httpd-2.4.29/[root@centos001 httpd-2.4.29]# ./configure --prefix=/usr/local/apache2.4 --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --enable-so --enable-mods-shared=most
错误2: 报错内容
configure: error: pcre-config for libpcre not found. PCRE is required and available from http://pcre.org/
解决方法:
[root@centos001 httpd-2.4.29]# yum list | grep pcrepcre.i686 8.32-17.el7 @base pcre.x86_64 8.32-17.el7 @base ghc-pcre-light.x86_64 0.4-13.el7 epel ghc-pcre-light-devel.x86_64 0.4-13.el7 epel mingw32-pcre.noarch 8.38-1.el7 epel mingw32-pcre-static.noarch 8.38-1.el7 epel mingw64-pcre.noarch 8.38-1.el7 epel mingw64-pcre-static.noarch 8.38-1.el7 epel pcre-devel.i686 8.32-17.el7 base pcre-devel.x86_64 8.32-17.el7 base pcre-static.i686 8.32-17.el7 base pcre-static.x86_64 8.32-17.el7 base pcre-tools.x86_64 8.32-17.el7 base pcre2.i686 10.23-2.el7 base pcre2.x86_64 10.23-2.el7 base pcre2-devel.i686 10.23-2.el7 base pcre2-devel.x86_64 10.23-2.el7 base pcre2-static.i686 10.23-2.el7 base pcre2-static.x86_64 10.23-2.el7 base pcre2-tools.x86_64 10.23-2.el7 base pcre2-utf16.i686 10.23-2.el7 base pcre2-utf16.x86_64 10.23-2.el7 base pcre2-utf32.i686 10.23-2.el7 base pcre2-utf32.x86_64 10.23-2.el7 base [root@centos001 httpd-2.4.29]# yum install -y pcre-devel
错误3.编译安装时报错
# 重新配置编译参数[root@centos001 httpd-2.4.29]# ./configure --prefix=/usr/local/apache2.4 --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --enable-so --enable-mods-shared=most# 输出错误信息collect2: error: ld returned 1 exit statusmake[2]: *** [htpasswd] 错误 1make[2]: 离开目录“/usr/local/src/httpd-2.4.29/support”make[1]: *** [all-recursive] 错误 1make[1]: 离开目录“/usr/local/src/httpd-2.4.29/support”make: *** [all-recursive] 错误 1[root@centos001 httpd-2.4.29]# echo $?2
解决方法:删除解压后的包,重新解压安装,配置编译参数(安装的时候没有看清版本,一直用的2.2
后面还是报错了,看到别人的解决方法使用后成功了,是先复制的文件 另外:链接是别人博客中的解决方法在configure后加上 “--with-included-apr”。
再重新编译, make, make install. 即可。 问题又来了,加上--with-included-apr之后,编译,报错如下: configure: error: Bundled APR requested but not found at ./srclib/. Download and unpack the corresponding apr and apr-util packages to ./srclib/. 错误为:apr,apr-util缺失,需要下载并解压到./srclib/目录下 解决办法: #cd /usr/local/src/# cp -r apr-1.5.2 /usr/local/src/httpd-2.4.7/srclib/apr #cp -r apr-util-1.5.4 /usr/local/src/httpd-2.4.7/srclib/apr-util
继续 :解决好上面的问题后 再make && make install 就能成功了
启动服务
#进入目录下,刚开始就是忘了 所以就没成功[root@centos001 httpd-2.4.29]# cd /usr/local/apache2.4/#命令行启动服务 这里不是报错是警告 如果有需求可以去配置文件里面改[root@centos001 apache2.4]# /usr/local/apache2.4/bin/apachectl startAH00558: httpd: Could not reliably determine the server's fully qualified domain name, using fe80::20c:29ff:fe34:4a63. Set the 'ServerName' directive globally to suppress this message#查看进程[root@centos001 apache2.4]# ps aux |grep httpdroot 2323 0.0 0.2 95528 2528 ? Ss 02:29 0:00 /usr/local/apache2.4/binhttpd -k startdaemon 2324 0.0 0.4 382356 4436 ? Sl 02:29 0:00 /usr/local/apache2.4/binhttpd -k startdaemon 2325 0.0 0.4 382356 4436 ? Sl 02:29 0:00 /usr/local/apache2.4/binhttpd -k startdaemon 2326 0.0 0.4 382356 4436 ? Sl 02:29 0:00 /usr/local/apache2.4/binhttpd -k startroot 2415 0.0 0.0 112676 984 pts/0 S+ 02:30 0:00 grep --color=auto httpd[root@centos001 apache2.4]# netstat -lntpActive Internet connections (only servers)Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1193/sshd tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1314/master tcp6 0 0 :::80 :::* LISTEN 2323/httpd tcp6 0 0 :::22 :::* LISTEN 1193/sshd tcp6 0 0 ::1:25 :::* LISTEN 1314/master tcp6 0 0 :::3306 :::* LISTEN 5790/mysqld
扩展
apache dso
apache apxs apache工作模式