CentOS7.3+MySQL5.7+Apache2.4+PHP7.1+phpMyAdmin4.7+JDK1.8+SVN1.6+Jenkins2.1环境搭建
1、安装CentOS7.3
虚拟机安装说明:在创建虚拟机时,选择桥接模式1)进入安装界面后,选择Install or upgrade an existing system选项
2)选择 English(United States)
3)选择美国英语式
设置选择:
时区:亚洲/上海时区、键盘:英语键盘+中文键盘、语言:美国英语、安装来源:(本地媒体)、安装方式:最小化安装(选中调试工具、兼容性库、开发者工具)、 kdump状态:开启、安全策略(选择标准系统的安全策略,即选择第2项,一切都可以)、网络:修改机器名称:centos7,其他后面再配置、 分区方式:手动分区-标准分区 /boot分区:512MB swap分区:4GB /分区:剩余空间4)输入root用户密码:123456
5)点击开始按钮,进行系统的安装
6)登录系统后,修改网卡文件
查看本地物理机器本地连接的中的IP地址:个人机器:192.168.1.133 公司机器:ipvi /etc/sysconfig/network-scripts/ifcfg-en33修改下列项为以下内容
个人机器的环境,配置如下;BOOTPROTO=staticONBOOT=yes #开启自动启用网络连接IPADDR=192.168.1.133 #设置IP地址 与物理机器需在同一网段,不能与主机地址相同NETMASK=255.255.255.0 #设置子网掩码 GATEWAY=192.168.1.1 #设置组网关 与物理机器网关地址一致DNS1=8.8.8.8 #设置主DNSDNS2=8.8.4.4 #设置备DNS 办公机器的环境,配置如下;BOOTPROTO=staticONBOOT=yes #开启自动启用网络连接IPADDR=ip1 #设置IP地址 与物理机器需在同一网段,不能与主机地址相同NETMASK=255.255.255.0 #设置子网掩码 GATEWAY=ip2 #设置组网关 与物理机器网关地址一致DNS1= #设置主DNSDNS2= #设置备DNS 完成修改后的配置:TYPE=EthernetBOOTPROTO=noneDEFROUTE=yesIPV4_FAILURE_FATAL=noIPV6INIT=yesIPV6_AUTOCONF=yesIPV6_DEFROUTE=yesIPV6_FAILURE_FATAL=noIPV6_ADDR_GEN_MODE=stable-privacyNAME=ens33UUID=999a1255-c734-43af-87b4-53f8e644ab71DEVICE=ens33ONBOOT=yesDNS1=域名地址1DNS2=域名地址2ZONE=publicIPADDR=IP地址1PREFIX=24GATEWAY=网关地址IPV6_PEERDNS=yesIPV6_PEERROUTES=yes #重启网卡#systemctl restart network.serviceservice network restart#测试网络是否正常
ping www.baidu.com#主机地址
ip addr设置主机名
hostname centos7vi /etc/hostname
centos7vi /etc/hosts
127.0.0.1 localhost centos7 localhost4 centos7::1 localhost centos7 localhost6 centos7原因:-bash: ifconfig: command not found
#ifup /etc/sysconfig/network-scripts/ifcfg-eno16777736ifup /etc/sysconfig/network-scripts/ifcfg-en33yum -y install net-tools.x86_64#重启系统
shutdown -r now 2、安装基础命令yum –y install gcc gcc-c++ pcre pcre-devel python python-develyum -y install cmake expat-devel gcc* libarchive libaio* openssl-devel zlib-devel yum -y install bmon dos2unix dstat htop lrzsz man nload unzip vim wget#替换yum源
cd /etc/yum.repos.d/cp CentOS-Base.repo CentOS-Base.repo.backupwget http://mirrors.163.com/.help/CentOS7-Base-163.repo
yum clean all
yum makecache
#安装man中文包访问:http://rpm.pbone.net/ 下载包:man-pages-zh-CN-1.5.2-4.el7.noarch.rpmcd /usr/local/src
wget ftp://ftp.icm.edu.pl/vol/rzm6/linux-centos-vault/7.4.1708/os/x86_64/Packages/man-pages-zh-CN-1.5.2-4.el7.noarch.rpm
rpm -ivh man-pages-zh-CN-1.5.2-4.el7.noarch.rpm
3、挂载光盘 安装ssh-sever ssh-client 练习挂载光盘用mount /dev/sr0 /mediadfcd /media/Packages安装:openssh-client时
rpm -ivh /media/Packages/openssh-clients-5.3p1-84.1.el6.x86_64.rpm出现如下问题:
libedit.so.0()(64bit) is needed by openssh-clients-5.3p1-84.1.el6.x86_64cd /usr/local/src/
rpm -ivh /media/Packages/libedit-2.11-4.20080712cvs.1.el6.x86_64.rpm卸载光盘
umount /dev/sr0 -l 4、安装SpotlightOnUnix_80有 spotlight 用户,则先删除userdel -r spotlightrm -rf /home/spotlightrm -rf /var/spool/mail/spotlight1)新建用户
useradd spotlightpasswd spotlight密码为: 1234562)修改 /etc/passwd 文件
vim /etc/passwd将spotlight:x:1000:1000::/home/spotlight:/bin/bash修改为spotlight:x:1000:0::/home/spotlight:/bin/bash让spotlight有root权限3)安装openssh sysstat vim
yum -y install sysstat vim4)使用Spotlight
通过输入IP地址:192.168.1.133 123456,可监控到Linux机器相关资源如果spotlight连接Linux后报 3500错误,提示 ssh 连接错误
#安装ssh服务
yum -y install openssh-server.x86_64#增加22端口,允许他通过防火强 SVN:3690 Tomcat:8080 Apache:8081 Jenkins:8082
firewall-cmd --zone=public --add-port=22/tcp --permanentfirewall-cmd --zone=public --add-port=443/tcp --permanentfirewall-cmd --zone=public --add-port=3306/tcp --permanentfirewall-cmd --zone=public --add-port=3690/tcp --permanentfirewall-cmd --zone=public --add-port=8080/tcp --permanentfirewall-cmd --zone=public --add-port=8081/tcp --permanentfirewall-cmd --zone=public --add-port=8082/tcp --permanent#重新加载防火强
firewall-cmd --reload#查看通过防火强的端口
firewall-cmd --zone=public --list-ports#重启防火强
systemctl restart firewalld.service 5、使用源码方式,用tar.gz包,去安装MySQL5.7访问:https://dev.mysql.com/downloads/mysql/5.7.html#downloads下载:mysql-5.7.22-linux-glibc2.12-x86_64.tar.gzcd /usr/local/src/
#卸载mariadb
rpm -qa|grep mariadbrpm -e --nodeps mariadb-libs-5.5.52-1.el7.x86_64#删除my.cnf文件
rm -rf /etc/my.cnfrm -rf /tmp/mysql.sockrm -rf /tmp/systemd*rm -rf /usr/local/mysql#检查mysql是否存在
rpm -qa |grep mysql#检查mysql用户和组是否存在,不存在则创建
#有则删除userdel -r mysqlgroupdel mysqlcat /etc/group |grep mysql
cat /etc/passwd |grep mysqlgroupadd mysql
useradd -g mysql mysql#密码为: 123456passwd mysql #解压缩文件cd /usr/local/src/tar zxvf mysql-5.7.22-linux-glibc2.12-x86_64.tar.gz
mv mysql-5.7.22-linux-glibc2.12-x86_64 /usr/local/mysql
cp mysql/support-files/my-default.cnf /etc/my.cnf
#新建my.cnf文件,内容如下
vim /etc/my.cnf[mysql]default-character-set = utf8mb4socket=/var/lib/mysql/mysql.sock[mysqld]
#skip-grant-tablesskip-name-resolveport=3306socket=/var/lib/mysql/mysql.sockcharacter-set-server=utf8mb4
collation-server=utf8mb4_unicode_ciinit_connect='SET NAMES utf8mb4'#mysql数据库的数据的存放目录
datadir=/usr/local/mysql/data#mysql的安装目录
basedir=/usr/local/mysqlmax_connections=200
max_allowed_packet = 128Mlower_case_table_name=1table_open_cache=2000
default-storage-engine=INNODBsql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES#安装数据库
cd /usr/local/mysqlchown -R mysql:mysql ./
./bin/mysqld --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --initialize --explicit_defaults_for_timestamp
#安装完成结果
===================================成功信息===================================2018-06-09T09:35:18.164280Z 0 [Warning] InnoDB: New log files created, LSN=457902018-06-09T09:35:18.201677Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.2018-06-09T09:35:18.266221Z 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: 6be5edfd-6bc8-11e8-9f65-000c2920c456.2018-06-09T09:35:18.269719Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.2018-06-09T09:35:18.271917Z 1 [Note] A temporary password is generated for root@localhost: EdGjhG#uN5iM2018-06-09T09:35:23.608189Z 1 [Warning] 'user' entry 'root@localhost' ignored in --skip-name-resolve mode.2018-06-09T09:35:23.608238Z 1 [Warning] 'user' entry 'mysql.session@localhost' ignored in --skip-name-resolve mode.2018-06-09T09:35:23.608253Z 1 [Warning] 'user' entry 'mysql.sys@localhost' ignored in --skip-name-resolve mode.2018-06-09T09:35:23.608277Z 1 [Warning] 'db' entry 'performance_schema mysql.session@localhost' ignored in --skip-name-resolve mode.2018-06-09T09:35:23.608285Z 1 [Warning] 'db' entry 'sys mysql.sys@localhost' ignored in --skip-name-resolve mode.2018-06-09T09:35:23.608297Z 1 [Warning] 'proxies_priv' entry '@ root@localhost' ignored in --skip-name-resolve mode.2018-06-09T09:35:23.608335Z 1 [Warning] 'tables_priv' entry 'user mysql.session@localhost' ignored in --skip-name-resolve mode.2018-06-09T09:35:23.608346Z 1 [Warning] 'tables_priv' entry 'sys_config mysql.sys@localhost' ignored in --skip-name-resolve mode.===================================成功信息===================================#授予权限
chown -R mysql:mysql data#复制启动脚本并修改属性
chmod 777 /etc/my.cnf#复制配置文件
cp /usr/local/mysql/support-files/mysql.server /etc/rc.d/init.d/mysqldchmod +x /etc/rc.d/init.d/mysqld
设置自定启动及启动mysql服务chkconfig --add mysqldchkconfig --list mysqldsystemctl restart mysqld#启动mysqld服务
systemctl start mysqld检查是否启动成功
ps aux |grep mysqld #配置环境变量vim /etc/profileMYSQL_HOME=/usr/local/mysqlPATH=$PATH:$MYSQL_HOME/binexport MYSQL_HOME PATH
:wq
source /etc/profile #方式1:如果有原始密码,则通过改方式修改密码mysql -uroot -pEnter password:直接回车use mysql;
update user set password=password('123456') where user='root' and host='localhost';
flush privileges;
#设置成远程主机能够登录
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456' WITH GRANT OPTION;flush privileges;#方式2:不知道原始密码,则通过改方式修改密码
/usr/local/mysql//bin/mysqladmin -u root password '123456'mysql -uroot -p
Enter password:直接回车use mysql;
update user set password=password('123456') where user='root' and host='localhost';
flush privileges;#设置成远程主机能够登录
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456' WITH GRANT OPTION;flush privileges;#重启mysqld
systemctl restart mysqld 6、安装apr1.6.3yum -y install libtool* expat-develwget http://mirror.bit.edu.cn/apache//apr/apr-1.6.3.tar.gz
tar zxvf apr-1.6.3.tar.gzchown -R root:root apr-1.6.3cd apr-1.6.3./configure --prefix=/usr/local/apr#如果提示有报错
rm: cannot remove 'libtoolT': No such file or directory#需修改configure文件vim configure在 30976 行,注释内容 # $RM "$cfgfile"在 30375 行中,修改RM='$RM -f'继续编译:./configure --prefix=/usr/local/apr
make && make install
7、安装apr-iconv-1.2.2cd /usr/local/srcwget http://mirror.bit.edu.cn/apache//apr/apr-iconv-1.2.2.tar.gztar zxvf apr-iconv-1.2.2.tar.gzchown -R root:root apr-iconv-1.2.2cd apr-iconv-1.2.2./configure --prefix=/usr/local/apriconv --with-apr=/usr/local/apr/bin/apr-1-configmake && make install 8、安装apr-util1.6.1cd /usr/local/srcwget http://mirror.bit.edu.cn/apache//apr/apr-util-1.6.1.tar.gztar xvzf apr-util-1.6.1.tar.gzchown -R root:root apr-util-1.6.1cd apr-util-1.6.1./configure --prefix=/usr/local/aprutil --with-apr=/usr/local/apr/bin/apr-1-config --with-apr-iconv=/usr/local/apriconv/bin/apriconvmake && make install 9、安装pcre8.4cd /usr/local/src/wget https://ftp.pcre.org/pub/pcre/pcre-8.40.tar.gztar zxvf pcre-8.40.tar.gzchown -R root:root pcre-8.40cd pcre-8.40./configure --prefix=/usr/local/pcre --with-apr=/usr/local/apr/bin/apr-1-configmake && make install 10、安装libxml2.7#使用tar.gz的包,将libxml2 安装到指定位置wget http://xmlsoft.org/sources/libxml2-2.7.6.tar.gztar zxvf libxml2-2.7.6.tar.gzchown -R root:root libxml2-2.7.6
cd libxml2-2.7.6
#编译安装
#如果提示有报错rm: cannot remove 'libtoolT': No such file or directory#需修改configure文件
在 23675 行,注释内容 #$RM "$cfgfile"#继续编译
./configure --prefix=/usr/local/libxml2#安装
make && make install 11、安装apache2.4yum -y install expat-devel zlib-devel openssl-develwget http://mirrors.hust.edu.cn/apache/httpd/httpd-2.4.29.tar.gz#删除系统自带的httpd
rpm -qa php mysql httpd rpm -e httpd --nodepstar zxvf httpd-2.4.29.tar.gz
chown -R root:root httpd-2.4.29cd httpd-2.4.29./configure --prefix=/usr/local/apache --with-pcre=/usr/local/pcre --with-apr=/usr/local/apr --with-apr-util=/usr/local/aprutil --with-libxml2=/usr/local/libxml2 --enable-headers --enable-so --enable-rewrite --enable-cgi --enable-modules=most --enable-mods-shared=most --enable-mpms-shared=all --with-mpm=event --enable-expires --enable-deflate
#加载所有的shared模块
make && make install #配置环境变量vim /etc/profileJAVA_HOME=/data/local/java
JRE_HOME=/usr/local/java/jreMYSQL_HOME=/usr/local/mysqlAPACHE_HOME=/usr/local/apachePATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin:$APACHE_HOME/bin:$MYSQL_HOME/binCLASSPATH=.:$JAVA_HOME/lib:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jarexport JAVA_HOME JRE_HOME APACHE_HOME MYSQL_HOME PATH CLASSPATH LD_LIBRARY_PATH保存后退出
:wqsource /etc/profile #查询模块命令httpd -M#如出现如下错误,则解决如下
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1. Set the 'ServerName' directive globally to suppress this message#修改配置文件 /usr/local/apache/conf/httpd.conf ,找到 Listen、ServerAdmin、ServerName 改成为如下内容
#修改这3项,是为了让php与apache整合成功Listen 8081ServerAdmin 192.168.1.133:8081ServerName 192.168.1.133:8081 #将httpd加入系统服务\cp -f /usr/local/apache/bin/apachectl /etc/init.d/httpd#修改httpd文件,在第3行增加如下内容
vim /etc/init.d/httpd# chkconfig: 345 85 21# description: apache 2.4.29#修改httpd为随系统自启动
chkconfig --add httpdchkconfig httpd onchkconfig --list httpd #启动apachecd /usr/local/apache/bin./apachectl stop./apachectl start检查是否启动成功
ps aux |grep httpd查看防火强是否启动
systemctl status firewalld.service#安装mod_ssl扩展及手册
mod_ssl httpd-manualyum -y install httpd-manual httpd-tools mod_ssl检查apache是否启动成功
http://192.168.1.133:8081/ 12、安装php7.1#php官网地址:http://php.net/#php7.1.18包地址,访问该地址后再下载包文件:http://php.net/get/php-7.1.18.tar.gz/from/a/mirror#解压缩php7的包
#安装参考地址:https://my.oschina.net/hhly/blog/1547227cd /usr/local/src/yum -y install cURL curl-devel libjpeg libjpeg-devel libpng libpng-devel
yum -y install autoconf automake bison bzip2 clang cmake yum -y install freetype-devel freetype* libtomcrypt* fontconfigyum -y install gd-devel git libcurl libcurl* libevent* g gcc gcc-c++yum -y install libmcrypt libmcrypt-devel libtool libtool-ltdl-devel yum -y install lrzsz make mcrypt mhash ncurses-devel opensslyum -y install openssl-devel patch php-mbstring php-mcrypt php-mysqli yum -y install python-devel readline-devel sudo unzip wget zlib zlib-devel expat-develyum -y install recode recode-devel libtidy libtidy-devl libtidyp libtidyp-devel libxslt libxslt-develyum clean allyum makecache tar zxvf php-7.1.18.tar.gzcd php-7.1.18/
./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-apxs2=/usr/local/apache/bin/apxs --with-libxml-dir=/usr/local/libxml2 --with-mysqli=/usr/local/mysql/bin/mysql_config --enable-mbstring --with-pdo-mysql
如编译mysql时有问题,则后面手动编译新增该模块:
--with-mysqli=/usr/local/mysql/bin/mysql_configmake && make install
#当安装完成后,出现如下内容:
libtool: warning: remember to run 'libtool --finish /usr/local/src/php-7.1.18/libs'按这里执行:
libtool --finish /usr/local/src/php-7.1.18/libs#配置环境变量
vim /etc/profileJAVA_HOME=/usr/local/java
JRE_HOME=/usr/local/java/jrePHP_HOME=/usr/local/phpMYSQL_HOME=/usr/local/mysqlAPACHE_HOME=/usr/local/apachePATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PHP_HOME/bin:$APACHE_HOME/bin:$MYSQL_HOME/bin:$PATHCLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib:$MYSQL_HOME/libexport JAVA_HOME JRE_HOME PHP_HOME APACHE_HOME MYSQL_HOME PATH CLASSPATH LD_LIBRARY_PATH
保存后退出
:wqsource /etc/profile#从安装包中复制 php.ini、php-fpm.conf 文件到安装目录
cp /usr/local/src/php-7.1.18/php.ini* /usr/local/php/etc/cd /usr/local/php/etc/
cp php.ini-development php.ini
#复制 opcache.so mbstring.so 到php扩展目录下
cd /usr/lib64/php/modulescp *.so /usr/local/php/lib/php/extensions/no-debug-zts-20160303/#配置php.ini文件
;设置不显示错误日志display_errors = Off#在关闭display_errors后开启PHP错误日志(路径在php-fpm.conf中配置)
log_errors = On;设置字符集
default_charset = "UTF-8";设置文件上传大小
upload_max_filesize = 2M;设置表单最大值大小,单位MB
;Maximum size of POST data that PHP will accept.post_max_size = 8M;设置扩展库路径
extension_dir = "/usr/local/php/lib/php/extensions/no-debug-zts-20160303/";设置时区
date.timezone = PRC#启动以下3个模块,如果没有需要添加
extension=opcache.soextension=mysqli.soextension=mbstring.soextension=gd.so#extension=ldap.soextension=json.soextension=curl.so#mbstring项配置
[mbstring]mbstring.language = Chinesembstring.internal_encoding = UTF-8
mbstring.http_input = UTF-8
mbstring.http_output = UTF-8
mbstring.encoding_translation = On
mbstring.detect_order = auto
;开启opcache,默认是0[opcache]; Determines if Zend OPCache is enabledopcache.enable=1#解决办法:没有找到 PHP 扩展 mbstring,而您现在正在使用多字节字符集。没有 mbstring 扩展的 phpMyAdmin 不能正确分割字符串并可能产生意料之外的结果。
#安装 mysqli.so扩展,安装其他扩展如: mbstring.so 也可参考 mysqli.so 方法,进入对应的扩展目录操作即可#如果 /usr/local/php/lib/php/extensions/no-debug-zts-20160303/ 目录下没有 mysqli.so 扩展,则需要进行下面安装扩展的操作#进入php源文件目录 安装 mysqli.so gd.so ldap.so curl.so 扩展方式1:直接用 pecl命令安装扩展先升级pecl
./pecl channel-update pecl.php.netcd /usr/local/php/bin
./pecl searche mysqli./pecl install mysqli安装好后,在 php.ini 文件新增内容
extension=mysqli.so方式2:使用 phpize 命令
#进入php源文件目录cd /usr/local/src/php-7.1.18/ext/mysqli/usr/local/php/bin/phpize#php中安装mysqli
./configure --with-php-config=/usr/local/php/bin/php-configmake && make install #建立软连接ln -sf /usr/local/php/bin/php /usr/bin/ln -sf /usr/local/php/bin/phpize /usr/bin/ln -sf /usr/local/php/bin/php-config /usr/bin/ln -sf /usr/local/php/bin/php-cgi /usr/bin/#覆盖 /etc/php.ini 文件,如果 对应扩展已开启,则不需添加扩展
\cp -rf /usr/local/php/etc/php.ini /etc/php.ini 13、整合PHP7.1和Apache2.4#修改配置文件vim /usr/local/apache/conf/httpd.conf在这里新增以下内容#查看httpd.conf文件,是否有配置加载php7的模块,没有的话需要配置LoadModule php7_module modules/libphp7.so#并<IfModule mime_module>模块下方,增加如下模块内容
AddType application/x-httpd-php .php .php7 AddType application/x-httpd-php-source .phps#AddHandler type-map var
AddHandler php7-script php#在模块dir_module 增加index.php
<IfModule dir_module> DirectoryIndex index.php index.html</IfModule>#需改 Directory 如下
<Directory /> #AllowOverride none AllowOverride All Allow From all #Require all denied</Directory> #保持 httpd.conf 文件统一\cp -rf /usr/local/apache/conf/httpd.conf /etc/httpd/conf/httpd.conf#在该目录下新增 info.php文件
cd /usr/local/apache/htdocs新增 info.php文件,内容为:
<?phpphpinfo();?> #重启启动apachecd /usr/local/apache/bin./apachectl stop./apachectl start #检查php整合apache是否成功http://192.168.1.133:8081/info.php#若果显示php版本及相关信息,则整合成功
PHP Version 7.1.18等 13、安装phpMyAdmin4.7官网地址:https://www.phpmyadmin.net/安装包文件:https://files.phpmyadmin.net/phpMyAdmin/4.7.9/phpMyAdmin-4.7.9-all-languages.zip#新建test用户
#以root用户访问数据后,新建 testuser3 用户 root 用户的密码:123456mysql -uroot -pEnter password:输入密码 回车#set global validate_password_policy=0;
#set global validate_password_length=4;use mysql;
#创建 testuser3 用户 密码为:123456 允许通过外网访问
create user 'testuser3'@'192.168.1.133' identified by '123456';create user 'testuser3'@'localhost' identified by '123456';create user 'testuser3'@'%' identified by '123456'; #刷新权限flush privileges;#用户通过外网IP访问数据库,权限为所有权限
grant all privileges on *.* to 'testuser3'@'192.168.1.133';grant all privileges on *.* to 'testuser3'@'localhost';grant all privileges on *.* to 'testuser3'@'%'; #刷新权限flush privileges;exit;
#安装phpMyAdmin
unzip phpMyAdmin-4.7.9-all-languages.zipcd /usr/local/src/
cp -Rf phpMyAdmin-4.7.9-all-languages /usr/local/apache/htdocs/phpmyadmin
chown -R root:root /usr/local/apache
修改配置文件/usr/local/apache/htdocs/phpmyadmin/libraries/config.default.php
cd /usr/local/apache/htdocs/phpmyadmin/libraries
cp config.default.php config.default.php.bak
vim config.default.php
修改连接数据库的各项配置$cfg['PmaAbsoluteUri'] = 'http://192.168.1.133:8081/phpmyadmin';$cfg['blowfish_secret'] ='http://192.168.1.133:8081/phpwind';#数据库主机IP
$cfg['Servers'][$i]['host'] = '192.168.1.133';#数据库端口号
$cfg['Servers'][$i]['port'] = '3306';#数据库用户
$cfg['Servers'][$i]['user'] = 'testuser3';#数据库用户密码:安装时访问数据库时输入的密码
$cfg['Servers'][$i]['password'] = '123456'; 完成并保存后退出重新访问地址: http://192.168.1.133:8081/phpmyadmin/index.php输入 账用户名: testuser3 密码:123456 后点击执行,成功后,进入phpmyadmin界面。
如果出现禁用功能,则修改文件 /etc/selinux/config内容
将 SELINUX=enforcing 改为 SELINUX=disabled保存后退出
esc :wq 15、安装JDK1.8cd /usr/local/src/tar zxvf jdk-8u144-linux-x64.tar.gzmv jdk1.8.0_144 /usr/local/javacd /usr/local/
chown -R root:root java/#配置环境变量
vim /etc/profileJAVA_HOME=/usr/local/java
JRE_HOME=/usr/local/java/jrePHP_HOME=/usr/local/phpAPACHE_HOME=/usr/local/apacheMYSQL_HOME=/usr/local/mysqlPATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PHP_HOME:$APACHE_HOME/bin:$MYSQL_HOME/bin:$PATHCLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JAVA_HOME/libexport JAVA_HOME JRE_HOME PHP_HOME APACHE_HOME MYSQL_HOME PATH CLASSPATH
保存后退出
:wqsource /etc/profile 16、安装SVN1.61)新增加testuser1、testuser3、testuser2用户useradd testuser1useradd testuser2useradd testuser32)设置testuser1、testuser3、testuser2用户的密码 密码为: 123456
passwd testuser1passwd testuser3passwd testuser23)对testuser1用户进行sudo设置
visudo在 root行处填加并保存后退出
root ALL=(ALL) ALLtestuser1 ALL=(ALL) NOPASSWD:ALLtestuser2 ALL=(ALL) NOPASSWD:ALL4)安装svn服务端
su testuser1sudo yum -y install subversion5)创建svn仓库,仓库为TEST
sudo svnadmin create /data/TEST6)配置访问SVN版本库用户的文件
/data/TEST/conf/passwd/data/TEST/conf/authz7)新增testuser1、testuser2、testuser3用户
sudo vim /data/TEST/conf/passwd新增以下内容testuser1=123456testuser2=123456testuser3=1234568)授予testuser1、 testuser2读写权限,testuser3只读权限
sudo vim /data/TEST/conf/authz修改为以下内容[groups]admin=testuser1,testuser2[/]
@admin=rwtestuser3=r*=8)修改svnserve.conf文件sudo vim /data/TEST/conf/svnserve.conf打开这5项配置,并配置如下,取消的注释前不能留空格。anon-access = read #匿名用户可读auth-access = write #授权用户可写password-db = passwd #使用哪个文件作为账号文件authz-db = authz #使用哪个文件作为权限文件realm = /data/TEST # 认证空间名,版本库所在目录9)启动svn服务
sudo svnserve -d -r /data/TEST停止svn服务:sudo killall svnserve10)本机电脑已安装svn客服端,因此直接使用就好,默认端口为:3690
设置防火强允许该端口通过 #增加22端口,允许他通过防火强 svn:3690 tomcat:8080 apache:8081 jenkins:8082firewall-cmd --zone=public --add-port=22/tcp --permanentfirewall-cmd --zone=public --add-port=443/tcp --permanentfirewall-cmd --zone=public --add-port=3306/tcp --permanentfirewall-cmd --zone=public --add-port=3690/tcp --permanentfirewall-cmd --zone=public --add-port=8080/tcp --permanentfirewall-cmd --zone=public --add-port=8081/tcp --permanentfirewall-cmd --zone=public --add-port=8082/tcp --permanent #重新加载防火强firewall-cmd --reload#查看通过防火强的端口
firewall-cmd --zone=public --list-ports#重启防火强
systemctl restart firewalld.service客服端:通过 svn://192.168.1.133:3690/ 访问 17、安装Jenkins2.1地址:https://pkg.jenkins.io/redhat-stable/jenkins-2.107.3-1.1.noarch.rpmwget https://pkg.jenkins.io/redhat-stable/jenkins-2.107.3-1.1.noarch.rpm
以rpm包的方式安装jenkinsrpm -ivh jenkins-2.107.3-1.1.noarch.rpmjenkins启动成功并安装好后,密码存放在以下路径的文件中
/var/lib/jenkins/secrets/initialAdminPassword修改 jenkins端口号
vim /etc/sysconfig/jenkins将8080 改为8082JENKINS_PORT="8082" #将 Jenkins 添加为系统服务chmod +x /etc/init.d/jenkinschkconfig --add jenkinschkconfig --list jenkins启动、停用、重启jenkins命令
systemctl start jenkins如果启动报错,则需要在 修改 /etc/init.d/jenkins 中JDK的配置
在candidates配置项中 配上jdkcandidates="/etc/alternatives/java/usr/lib/jvm/java-1.8.0/bin/java/usr/lib/jvm/jre-1.8.0/bin/java/usr/lib/jvm/java-1.7.0/bin/java/usr/lib/jvm/jre-1.7.0/bin/java/usr/bin/java/usr/local/java/bin/java #加上这个配置jenkins目录说明
#war包/usr/lib/jenkins/jenkins.war#日志文件
/var/log/jenkins/jenkins.log#配置文件
/etc/sysconfig/jenkins#Jenkins_home目录
/var/lib/jenkins 配置Jenkins#在浏览器中访问jenkins所在服务器的地址,管理员账号:admin 密码:123456http://192.168.1.133:8082#密码文件: /var/lib/jenkins/secrets/initialAdminPassword 密码: 3fb6b93cc60c4498bda4ef2d5d57e495
#选择推荐安装标签项#新建admin账户 用户名:admin 密码:123456#后面Jenkins自动安装插件,需要一段时间,大概10分钟,完成后可以开始使用Jenkins。