目录
一、apache安装
二、MySQL安装
一、apache安装
准备环境:一台虚拟机、三个安装包(apr-1.6.2.tar.gz、apr-util-1.6.0.tar.gz、httpd-2.4.29.tar.bz2)
安装过程:
tar xf apr-1.6.2.tar.gz
tar xf apr-util-1.6.0.tar.gz
tar xf httpd-2.4.29.tar.bz2
mv apr-1.6.2 httpd-2.4.29/srclib/apr
mv apr-util-1.6.0 httpd-2.4.29/srclib/apr-utilyum -y install \
gcc \
gcc-c++ \
make \
pcre-devel \
expat-devel \
perlcd /opt/httpd-2.4.29/
./configure \
--prefix=/usr/local/httpd \
--enable-so \
--enable-rewrite \
--enable-charset-lite \
--enable-cgimake -j 2 && make installln -s /usr/local/httpd/conf/httpd.conf /etc/
ln -s /usr/local/httpd/bin/* /usr/local/bin/vim /lib/systemd/system/httpd.service
[Unit]
Description=The Apache HTTP Server #描述
After=network.target #描述服务类别
[Service]
Type=forking #后台运行方式
PIDFile=/usr/local/httpd/logs/httpd.pid #PID文件位置
ExecStart=/usr/local/bin/apachectl $OPTIONS #启动服务
ExecReload=/bin/kill -HUP $MAINPIDvi /usr/local/httpd/conf/httpd.conf
--197行--取消注释,修改
ServerName 192.168.10.80:80
--221行--默认首页存放路径
DocumentRoot "/usr/local/httpd/htdocs" 以后 有存储
--255行--默认首页文件名设置
DirectoryIndex index.html
---》wqhttpd -tcat /usr/local/httpd/htdocs/index.htmlservice httpd restart
netstat -anpt | grep 80
二、MySQL安装
安装环境:一台虚拟机、两个安装包(boost_1_59_0.tar.gz、mysql-5.7.17.tar.gz)
安装步骤:
yum -y install gcc gcc-c++ ncurses ncurses-devel bison cmake
useradd -s /sbin/nologin mysql
tar zxvf mysql-5.7.17.tar.gz -C /opt
tar zxvf boost_1_59_0.tar.gz -C /usr/local/
mv /usr/local/boost_1_59_0 /usr/local/boostcd /opt/mysql-5.7.17/cmake \
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
-DMYSQL_UNIX_ADDR=/usr/local/mysql/mysql.sock \
-DSYSCONFDIR=/etc \
-DSYSTEMD_PID_DIR=/usr/local/mysql \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_EXTRA_CHARSETS=all \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_ARCHIVE_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITH_PERFSCHEMA_STORAGE_ENGINE=1 \
-DMYSQL_DATADIR=/usr/local/mysql/data \
-DWITH_BOOST=/usr/local/boost \
-DWITH_SYSTEMD=1make -j3 && make installchown -R mysql:mysql /usr/local/mysql/ #更改管理主/组
chown mysql:mysql /etc/my.cnfvim /etc/my.cnf #删除文件下所有内容
[client]
port = 3306
default-character-set=utf8
socket=/usr/local/mysql/mysql.sock [mysql]
port = 3306
default-character-set=utf8
socket=/usr/local/mysql/mysql.sock
auto-rehash[mysqld]
user = mysql
basedir=/usr/local/mysql
datadir=/usr/local/mysql/data
port = 3306
character-set-server=utf8
pid-file = /usr/local/mysql/mysqld.pid
socket=/usr/local/mysql/mysql.sock
bind-address = 0.0.0.0
skip-name-resolve
max_connections=2048
default-storage-engine=INNODB
max_allowed_packet=16M
server-id = 1
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_AUTO_VALUE_ON_ZERO,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,PIPES_AS_CONCAT,ANSI_QUOTESecho "PATH=$PATH:/usr/local/mysql/bin" >> /etc/profile
source /etc/profilecd /usr/local/mysql/bin/
./mysqld \
--initialize-insecure \
--user=mysql \
--basedir=/usr/local/mysql \
--datadir=/usr/local/mysql/datacp /usr/local/mysql/usr/lib/systemd/system/mysqld.service /usr/lib/systemd/system/systemctl daemon-reload
systemctl start mysqld.service
systemctl enable mysqldmysqladmin -u root -p password "123456"mysql -u root -p123456 #登录查看