1. redhat6 网卡配置
打开系统发现系统默认auto eth0 ,自己配的system eth0 没有启用,把auto eth0删除后重启network服务,报错没找到设备。
用ifconfig 查看发现,启动的还是auto eth0。
编辑文件/etc/udev/rules.d/70-persistent-net.rules
最终发现是 因为 mac addr 配的不对导致网卡启动不了。
2. 用winscp 把文件传到服务器上
apr-1.6.2.tar.gz
apr-util-1.5.4.tar.gz
httpd-2.4.27.tar.gz
pcre-8.41.tar.gz
mysql-community-common-5.7.19-1.el6.x86_64.rpm
mysql-community-libs-5.7.19-1.el6.x86_64.rpm
mysql-community-client-5.7.19-1.el6.x86_64.rpm
mysql-community-server-5.7.19-1.el6.x86_64.rpm
oracle-instantclient11.2-basic-11.2.0.4.0-1.x86_64.rpm
php-5.6.31.tar.gz
yum-3.2.29-81.el6.centos.noarch.rpm
yum-metadata-parser-1.1.2-16.el6.x86_64.rpm
yum-plugin-fastestmirror-1.1.30-40.el6.noarch.rpm
yum-plugin-remove-with-leaves-1.1.30-40.el6.noarch.rpm
yum-plugin-upgrade-helper-1.1.30-40.el6.noarch.rpm
yum-plugin-versionlock-1.1.30-40.el6.noarch.rpm
3. 第一步安装mysql5.7.19
rpm -qa | grep -i mysql
显示已安装 mysql-libs-5.1.66-2.el6_3.x86_64
卸载之:yum -y remove mysql-libs*
必须按如下次序安装,否则会报库依赖错误,导致安装失败。
Rpm -ivh mysql-community-common-5.7.19-1.el6.x86_64.rpm
rpm -ivh mysql-community-libs-5.7.19-1.el6.x86_64.rpm
Rpm -ivh mysql-community-client-5.7.19-1.el6.x86_64.rpm
Rpm -ivh mysql-community-server-5.7.19-1.el6.x86_64.rpm
3.1默认安装目录如下。
数据库目录:/var/lib/mysql/
配置文件:/etc/my.cnf
/usr/share/mysql(mysql.server命令及配置文件)
相关命令:/usr/bin(mysqladmin mysqldump等命令)
启动脚本:/etc/rc.d/init.d/(启动脚本文件mysql的目录)
3.2 启动后查看日志发现的错误
日志路径:/var/log/mysqld.log
3.2.1 Can't open the mysql.plugin table. Please run mysql_upgrade to create it
先修改一下my.cnf 添加一行(注意,虽然太长,但不要回车换行,可能会出问题):
【sql_mode=ONLY_FULL_GROUP_BY,NO_AUTO_VALUE_ON_ZERO,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION,PIPES_AS_CONCAT,ANSI_QUOTES】
然后执行数据库初始化:mysqld --initialize --console
看错误日志/var/log/mysqld.log可以发现生成了root密码
【2017-11-21T03:14:17.477653Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 0f306bea-ce6a-11e7-8f6d-000c29a0ec02.
2017-11-21T03:14:17.593778Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2017-11-21T03:14:17.594715Z 1 [Note] A temporary password is generated for root@localhost:>-T4W60v-TW2】
执行启动代码:mysqld_safe --user=root --skip-grant-tables --skip-networking &
报错:【mysqld_safe mysqld from pid file /usr/local/mysql/data/localhost.localdomain.pid ended】
删除/usr/local/mysql/data/下的2个文件:ib_logfile0和ib_logfile1
重新执行:mysqld_safe --user=root --skip-grant-tables --skip-networking &
看错误日志报错【2017-11-22T01:26:09.816110Z 0 [ERROR] InnoDB: The innodb_system data file 'ibdata1' must be writable
2017-11-22T01:26:09.816128Z 0 [ERROR] InnoDB: The innodb_system data file 'ibdata1' must be writable
2017-11-22T01:26:09.816137Z 0 [ERROR] InnoDB: Plugin initialization aborted with error Generic error
2017-11-22T01:26:10.416769Z 0 [ERROR] Plugin 'InnoDB' init function returned error.
2017-11-22T01:26:10.416792Z 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2017-11-22T01:26:10.416804Z 0 [ERROR] Failed to initialize plugins.
2017-11-22T01:26:10.416820Z 0 [ERROR] Aborting】
执行修改权限命令:chmod -R 777 /usr/local/mysql/data/
重新执行:mysqld_safe --user=root --skip-grant-tables --skip-networking &
启动成功了,但命令执行后,一直没结束,没有看到光标。
然后执行数据库连接命令:mysql -hlocalhost -uroot -p>-T4W60v-TW2
结果返回后没看到连接成功,查看日志,看到如下消息
【[Note] Your password has expired. To log in you must change it using a client that supports expired passwords.】
然后执行:mysql -uroot -p --port=33999
成功了,可以连接到mysql,马上修改密码。
执行修改密码:set password=password(‘root’);
然后设置可任意ip连接mysql,执行:
update user set host='%' where host='localhost';
光有上面的还不行,还得关闭iptables。执行1(重启会失效,iptables服务会重启):service iptables stop
再执行2(确保执行后,服务不会再起来):chkconfig iptables off
然后呢,终于可以远程连接了,感动ing,现在可以说Mysql安装成功了。
4. 安装php5.6.31
安装文件:php-5.6.31.tar.gz;这是一个源码,安装方法是:解压, make ,install。但前提是安装好依赖包。
官网安装帮助文档:http://php.net/manual/zh/install.php
http://cnzhx.net/blog/apache-httpd-mod_proxy_fcgi-php-fpm/
http://www.jb51.net/article/112043.htm
http://blog.51cto.com/shhlamp/2046627
4.1 安装首先得安装一些依赖
执行【 yum install -y gcc gcc-c++ openssl openssl-devel libxml2 libxml2-devel autoconf libjpeg libjpeg-devel libpng libpng-devel gd bzip2 bzip2-devel curl curl-devel freetype freetype-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel】是可以把依赖都安装好,但是
本来是可以通过yum自动安装的,但执行后报错【This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.】
出现这个错误的原因是w未在redhat网络上注册,解决办法是可以使用从Redhat演化而来的免费Linux版本CentOS,通过CentOS的yum更新源来实现RHEL6的YUM功能。
4.1.1 查看已安装的Yum
执行:Rpm -qa|grep yum
显示:yum-3.2.29-40.el6.noarch
PackageKit-yum-0.5.8-21.el6.x86_64
yum-utils-1.1.30-14.el6.noarch
PackageKit-yum-plugin-0.5.8-21.el6.x86_64
yum-rhn-plugin-0.9.1-43.el6.noarch
yum-metadata-parser-1.1.2-16.el6.x86_64
yum-plugin-security-1.1.30-14.el6.noarch
4.1.2 卸载已安装的Yum
执行【rpm -qa|grep yum|xargs rpm -e --nodeps】
4.1.3 下载yum包
操作说明:http://blog.csdn.net/Ludwig_/article/details/52683926
地址:http://centos.ustc.edu.cn/centos/7.4.1708/os/x86_64/Packages/
下载centos6的包就好,太高了,支持的包也多,装出一堆依赖来,崩溃!
执行:【wget http://centos.ustc.edu.cn/centos/6.9/os/x86_64/Packages/yum-3.2.29-81.el6.centos.noarch.rpm
wget http://centos.ustc.edu.cn/centos/6.9/os/x86_64/Packages/yum-metadata-parser-1.1.2-16.el6.x86_64.rpm
wget http://centos.ustc.edu.cn/centos/6.9/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.30-40.el6.noarch.rpm
Wget http://centos.ustc.edu.cn/centos/6.9/os/x86_64/Packages/yum-plugin-upgrade-helper-1.1.30-40.el6.noarch.rpm
wget http://centos.ustc.edu.cn/centos/6.9/os/x86_64/Packages/yum-plugin-versionlock-1.1.30-40.el6.noarch.rpm
wget http://centos.ustc.edu.cn/centos/6.9/os/x86_64/Packages/yum-plugin-remove-with-leaves-1.1.30-40.el6.noarch.rpm
wget http://centos.ustc.edu.cn/centos/6.9/os/x86_64/Packages/python-iniparse-0.3.1-2.1.el6.noarch.rpm
wget http://centos.ustc.edu.cn/centos/6.9/os/x86_64/Packages/python-urlgrabber-3.9.1-11.el6.noarch.rpm】
4.1.4 安装次序
A.执行【rpm -ivh um-metadata-parser-1.1.2-16.el6.x86_64.rpm】
B.执行【rpm -ivh python-urlgrabber-3.9.1-11.el6.noarch.rpm】
安装不成功,执行命令:【rpm -qa|grep -i python-u】发现存在“python-urlgrabber-3.9.1-8.el6.noarch”
执行命令【rpm -e --nodeps python-urlgrabber-3.9.1-8.el6.noarch】卸载python-urlgrabber-3.9.1-8.el6.noarch
C. 两个互相依赖的包一起安装
执行【rpm -ivh yum-3.2.29-81.el6.centos.noarch.rpm】,报错“yum-plugin-fastestmirror is needed by yum-3.2.29-81.el6.centos.noarch”
执行【rpm -ivh yum-plugin-fastestmirror-1.1.30-40.el6.noarch.rpm】,报错“yum >= 3.0 is needed by yum-plugin-fastestmirror-1.1.30-40.el6.noarch”
好吧,网上说这两个包互相依赖,一起执行好了
【 rpm -ivh yum-3.2.29-81.el6.centos.noarch.rpm yum-plugin-fastestmirror-1.1.30-40.el6.noarch.rpm】果然成功了
D. 然后把剩下的几个插件包安装上,ok
4.1.5然后需要配置yum升级服务器地址
A. 下载配置文件CentOS-Base.repo
【wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo】
去“http://mirrors.163.com/centos”查看发现“http://mirrors.163.com/centos/6.9”下内容是全面的,而其他版本内容不全。所以修改“/etc/yum.repos.d/CentOS-Base.repo”把“$releasever”替换为“6.9”。
B. 执行【yum clean all】
C. 执行【yum makecache】
determining fastest mirrors
base/group_gz
base/filelists_db
base/primary_db
base/other_db
extras
extras/filelists_db......
看到一堆东西在滚..
4.2执行yum安装各种依赖包,为php安装做准备
执行【 yum install -y gcc gcc-c++ openssl openssl-devel libxml2 libxml2-devel autoconf libjpeg libjpeg-devel libpng libpng-devel gd bzip2 bzip2-devel curl curl-devel freetype freetype-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel】
开始安装了,漫长的过程.....总下载量61M.
牛逼啊,程序做的真好。服!
4.3 安装php5.6.31
./configure --prefix=/usr/local/php5.6.31/
make
make install
安装的好快,1-2秒.
5. 安装apache httpd-2.4.27
5.1 卸载apr和apr-util
执行【Rpm -qa|grep apr】
执行【r-1.6.2]# yum remove apr-1.3.9-5.el6_9.1.x86_64】
5.2 重新安装apr和apr-util
下载apr1.6.2 ,apr-util-1.6.0
执行【 tar -zxvf apr-1.6.2.tar.gz
tar -zxvf apr-util-1.6.0.tar.gz
cd apr-1.6.2
./configure --prefix=/usr/local/apr1.6.2
make
make install
cd ..
cd apr-util-1.6.0
./configure --prefix=/usr/local/apr-util-1.5.4 --with-apr=/usr/local/apr1.6.2
make
】
报错了,错误信息【xml/apr_xml.c:35:19: 错误:expat.h:没有那个文件或目录
xml/apr_xml.c:66: 错误:expected specifier-qualifier-list before ‘XML_Parser’
xml/apr_xml.c: 在函数‘cleanup_parser’中:】
执行【 yum install expat-devel -y】后再make通过了
再make intall 也过了。
5.3 重新安装pcre
执行【 tar -zxvf pcre-8.41.tar.gz
./configure --prefix=/usr/local/pcre8.41
Make
Make install】
5.4 安装apache
执行【./configure --prefix=/usr/local/apache --sysconfdir=/etc/httpd --enable-so --enable-rewirte --enable-ssl --enable-cgi --enable-cgid --enable-modules=most --enable-mods-shared=most --enable-mpms-shared=all --with-apr=/usr/local/apr1.6.2/ --with-apr-util=/usr/local/apr-util-1.6.1 --with-pcre=/usr/local/pcre8.41/
make】
报错啦【make[2]: *** [htpasswd] 错误 1
make[2]: Leaving directory `/user/mornwoo/httpd-2.4.27/support'
make[1]: *** [all-recursive] 错误 1
make[1]: Leaving directory `/user/mornwoo/httpd-2.4.27/support'】
网上说,原因是apr-util-1.6.1不适用,应该用apr-util-1.5,于是去下载了apr-util-1.5.4,删除apr-util-1.6.1安装目录后重新安装apr-util-1.5.4。
执行【 ./configure --prefix=/usr/local/apr-util-1.5.4 --with-apr=/usr/local/apr1.6.2
make
make install
cd ..
cd httpd-2.4.27
./configure --prefix=/usr/local/apache --sysconfdir=/etc/httpd --enable-so --enable-rewirte --enable-ssl --enable-cgi --enable-cgid --enable-modules=most --enable-mods-shared=most --enable-mpms-shared=all --with-apr=/usr/local/apr1.6.2/ --with-apr-util=/usr/local/apr-util-1.5.4 --with-pcre=/usr/local/pcre8.41/
make
make install 】成功了,成功安装