# 通常下載的包 都在這裏,因此傳文件也指定到這裏方便咱們查找 [root@centos001 src]# cd /usr/local/src/
1.Linux和windows互傳文件 安裝yum包
###用yum安裝一個包 lrzszhtml
2.從windows傳文件到linuxmysql
命令rz # 選項:rz -r適用於異常狀態時,如傳送出錯
3.解壓壓縮包linux
tar zxvf 包名
#進入目錄 [root@centos001 ~]# cd /usr/local/src/ [root@centos001 src]# ls httpd-2.2.34 mysql-5.1.73-linux-x86_64-glibc23.tar.gz httpd-2.2.34.tar.gz mysql-5.1.73-linux-x86_64-glibc23.tar.gz.1 mariadb-10.2.6-linux-glibc_214-x86_64 mysql-5.6.36-linux-glibc2.5-x86_64.tar.gz mariadb-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/mariadb bin data include mysql-test share COPYING DESTINATION INSTALL-BINARY README.md sql-bench COPYING.thirdparty docs lib README-wsrep support-files CREDITS 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 test aria_log_control ibdata1 ib_logfile1 performance_schema [root@centos001 mariadb]# ls /data/mysql/ auto.cnf ibdata1 ib_logfile1 performance_schema centos001.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_notify magic my-large.cnf mysqld_multi.server policy my-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 available Mem: 1008152 85576 146780 6876 775796 703000 Swap: 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/mariadb datadir=/data/mariadb conf=$basedir/my.cnf
[root@centos001 mariadb]# systemctl stop mysql [root@centos001 mariadb]# /etc/init.d/mariadb start Reloading systemd: [ 肯定 ] Starting mariadb (via systemctl): [ 肯定 ]
#進入安裝包目錄 [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]# ls apr-1.6.3 httpd-2.4.29.tar.gz apr-1.6.3.tar.gz mariadb-10.2.6-linux-glibc_214-x86_64.tar.gz apr-util-1.6.1.tar.bz2 mysql-5.1.73-linux-x86_64-glibc23.tar.gz httpd-2.2.34 mysql-5.1.73-linux-x86_64-glibc23.tar.gz.1 httpd-2.2.34.tar.gz mysql-5.6.36-linux-glibc2.5-x86_64.tar.gz httpd-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]# ls apr-config.in buildconf dso libapr.rc NOTICE support apr.dep build.conf emacs-mode LICENSE NWGNUmakefile tables apr.dsp build-outputs.mk encoding locks passwd test apr.dsw CHANGES file_io Makefile.in poll threadproc apr.mak CMakeLists.txt helpers Makefile.win random time apr.pc.in config.layout include memory README tools apr.spec configure libapr.dep misc README.cmake user atomic configure.in libapr.dsp mmap shmem build 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 $? 0 2.安裝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出錯sql
[root@centos001 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@centos001 apr-util-1.6.1]# yum install -y expat-devel
繼續安裝apache
#從新執行這個命令 [root@centos001 apr-util-1.6.1]# make && make install 3.安裝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: 報錯內容vim
configure: error: pcre-config for libpcre not found. PCRE is required and available from http://pcre.org/
解決方法:windows
[root@centos001 httpd-2.4.29]# yum list | grep pcre pcre.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.編譯安裝時報錯centos
# 從新配置編譯參數 [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 status make[2]: *** [htpasswd] 錯誤 1 make[2]: 離開目錄「/usr/local/src/httpd-2.4.29/support」 make[1]: *** [all-recursive] 錯誤 1 make[1]: 離開目錄「/usr/local/src/httpd-2.4.29/support」 make: *** [all-recursive] 錯誤 1 [root@centos001 httpd-2.4.29]# echo $? 2
解決方法:刪除解壓後的包,從新解壓安裝,配置編譯參數(安裝的時候沒有看清版本,一直用的2.2
後面仍是報錯了,看到別人的解決方法使用後成功了,是先複製的文件
另外:連接是別人博客中的解決方法
https://my.oschina.net/LuCastiel/blog/1590706緩存
在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 start AH00558: 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 httpd root 2323 0.0 0.2 95528 2528 ? Ss 02:29 0:00 /usr/local/apache2.4/binhttpd -k start daemon 2324 0.0 0.4 382356 4436 ? Sl 02:29 0:00 /usr/local/apache2.4/binhttpd -k start daemon 2325 0.0 0.4 382356 4436 ? Sl 02:29 0:00 /usr/local/apache2.4/binhttpd -k start daemon 2326 0.0 0.4 382356 4436 ? Sl 02:29 0:00 /usr/local/apache2.4/binhttpd -k start root 2415 0.0 0.0 112676 984 pts/0 S+ 02:30 0:00 grep --color=auto httpd [root@centos001 apache2.4]# netstat -lntp Active 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
https://yq.aliyun.com/articles/6298
apache apxs
http://man.chinaunix.net/newsoft/ApacheMenual_CN_2.2new/programs/apxs.html
apache工做模式
http://www.cnblogs.com/fnng/archive/2012/11/20/2779977.html