我是靠谱客的博主 任性泥猴桃,最近开发中收集的这篇文章主要介绍lamt部署和Jenkinslamt安装mysql安装tomcatJenkins,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

lamt

文章目录

  • lamt
    • 安装httpd
  • 安装mysql
  • 安装tomcat
  • Jenkins

安装httpd

创建用户组

[root@localhost ~]# groupadd -r apache
[root@localhost ~]# useradd -r -M -s /sbin/nologin -g apache apache

安装依赖包

[root@localhost ~]# yum -y install openssl-devel pcre-devel expat-devel libtool gcc gcc-c++ bzip2 make

安装apr以及apr-util

[root@localhost ~]# tar xf apr-1.6.3.tar.bz2 
[root@localhost ~]# ls
anaconda-ks.cfg  apr-1.6.3  apr-1.6.3.tar.bz2  apr-util-1.6.1.tar.bz2  httpd-2.4.43.tar.bz2
[root@localhost ~]# tar xf apr-util-1.6.1.tar.bz2 
[root@localhost ~]# ls
anaconda-ks.cfg  apr-1.6.3.tar.bz2  apr-util-1.6.1.tar.bz2
apr-1.6.3        apr-util-1.6.1     httpd-2.4.43.tar.bz2
[root@localhost ~]# cd apr-1.6.3
[root@localhost apr-1.6.3]# vi configure
$RM "$cfgfile"    //将此行注释或者删除
[root@wnz apr-1.6.3]# ./configure --prefix=/usr/local/apr
[root@wnz apr-1.6.3]# make && make install
[root@wnz apr-1.6.3]# cd ../apr-util-1.6.1
[root@wnz apr-util-1.6.1]# ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr


安装httpd

[root@localhost ~]# tar xf httpd-2.4.43.tar.gz 
[root@localhost ~]# cd httpd-2.4.43
[root@localhost httpd-2.4.43]# ./configure --prefix=/usr/local/apache --sysconfdir=/etc/httpd24 --enable-proxy --enable-proxy-connect --enable-so --enable-ssl --enable-cgi --enable-rewrite --with-zlib --with-pcre --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util/ --enable-modules=most --enable-mpms-shared=all --with-mpm=prefork
[root@wnz httpd-2.4.43]# make && make install

安装后配置

[root@localhost ~]# echo 'export PATH=/usr/local/apache/bin:$PATH' > /etc/profile.d/httpd.sh
[root@localhost ~]# source /etc/profile.d/httpd.sh
[root@localhost ~]# ln -s /usr/local/apache/include/ /usr/include/httpd
[root@localhost ~]# echo 'MANPATH /usr/local/apache/man' >> /etc/man_db.conf

取消ServerName前面的注释

[root@localhost ~]# sed -i '/#ServerName/s/#//g' /etc/httpd24/httpd.conf

启动apache

[root@localhost ~]# apachectl start
[root@localhost ~]# ss -antl
State      Recv-Q     Send-Q           Local Address:Port           Peer Address:Port     Process     
LISTEN     0          128                    0.0.0.0:22                  0.0.0.0:*                    
LISTEN     0          128                          *:80                        *:*                    
LISTEN     0          128                       [::]:22                     [::]:*                   

安装mysql

安装依赖

[root@localhost ~]# yum -y install libaio ncurses-devel openssl-devel openssl cmake mariadb-devel 

创建用户和组

[root@localhost ~]# groupadd -r -g 306 mysql
[root@localhost ~]# useradd -r -M -s /sbin/nologin -g 306 -u 306 mysql

解压mysql软件包

[root@localhost ~]# ls
anaconda-ks.cfg    apr-util-1.6.1          httpd-2.4.43.tar.bz2
apr-1.6.3          apr-util-1.6.1.tar.bz2  mysql-5.7.24-linux-glibc2.12-x86_64.tar.gz
apr-1.6.3.tar.bz2  httpd-2.4.43
[root@localhost ~]# tar xf mysql-5.7.24-linux-glibc2.12-x86_64.tar.gz -C /usr/local/

创建软连接,修改文件属主

[root@localhost local]# ln -s mysql-5.7.24-linux-glibc2.12-x86_64/ mysql
[root@localhost local]# chown -R mysql.mysql mysql*

添加环境变量

[root@localhost local]# echo 'export PATH=/usr/local/mysql/bin:$PATH' > /etc/profile.d/mysql.sh
[root@localhost local]# source /etc/profile.d/mysql.sh

建立数据存放目录

[root@localhost ~]# mkdir /opt/data
[root@localhost ~]# chown -R mysql.mysql /opt/data

初始化数据库

[root@localhost ~]# /usr/local/mysql/bin/mysqld --initialize-insecure --user=mysql --datadir=/opt/data

配置mysql

[root@localhost ~]# ln -sv /usr/local/mysql/include/ /usr/local/include/mysql
'/usr/local/include/mysql' -> '/usr/local/mysql/include/'
[root@localhost ~]# echo '/usr/local/mysql/lib' > /etc/ld.so.conf.d/mysql.conf
[root@localhost ~]# ldconfig 

生成配置文件

[root@localhost ~]# cat > /etc/my.cnf <<EOF
> [mysqld]
> basedir = /usr/local/mysql
> datadir = /opt/data
> socket = /tmp/mysql.sock
> port = 3306
> pid-file = /opt/data/mysql.pid
> user = mysql
> skip-name-resolve
> EOF


配置服务启动脚本

[root@localhost ~]# cp -a /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld
[root@localhost ~]# sed -ri 's#^(basedir=).*#1/usr/local/mysql#g' /etc/init.d/mysqld
[root@localhost ~]# sed -ri 's#^(datadir=).*#1/opt/data#g' /etc/init.d/mysqld

设置开机自启

[root@localhost ~]# chkconfig --add mysqld
[root@localhost ~]# chkconfig --list

Note: This output shows SysV services only and does not include native
      systemd services. SysV configuration data might be overridden by native
      systemd configuration.

      If you want to list systemd services use 'systemctl list-unit-files'.
      To see services enabled on particular target use
      'systemctl list-dependencies [target]'.

mysqld         	0:off	1:off	2:on	3:on	4:on	5:on	6:off

启动mysql

[root@localhost ~]# service mysqld start
Starting MySQL.Logging to '/opt/data/localhost.localdomain.err'.
 SUCCESS! 
[root@localhost ~]# ss -antl
State      Recv-Q     Send-Q           Local Address:Port           Peer Address:Port     Process     
LISTEN     0          128                    0.0.0.0:22                  0.0.0.0:*                    
LISTEN     0          80                           *:3306                      *:*                    
LISTEN     0          128                          *:80                        *:*                    
LISTEN     0          128                       [::]:22                     [::]:*      

修改密码

[root@localhost ~]# mysql -e "set password = password('hzy123')"

安装tomcat

安装JDK

[root@localhost ~]# yum -y install java-1.8.0-openjdk java-1.8.0-openjdk-devel

解压

[root@localhost ~]# ls
anaconda-ks.cfg              apr-1.6.3.tar.bz2       httpd-2.4.43
apache-tomcat-9.0.37.tar.gz  apr-util-1.6.1          httpd-2.4.43.tar.bz2
apr-1.6.3                    apr-util-1.6.1.tar.bz2  mysql-5.7.24-linux-glibc2.12-x86_64.tar.gz
[root@localhost ~]# tar -xf apache-tomcat-9.0.37.tar.gz -C /usr/local/

创建软连接

[root@localhost ~]# cd /usr/local/
[root@localhost local]# ln -s apache-tomcat-9.0.37 tomcat

启动tomcat

[root@localhost local]# /usr/local/tomcat/bin/startup.sh 
Using CATALINA_BASE:   /usr/local/tomcat
Using CATALINA_HOME:   /usr/local/tomcat
Using CATALINA_TMPDIR: /usr/local/tomcat/temp
Using JRE_HOME:        /usr
Using CLASSPATH:       /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar
Tomcat started.
[root@localhost local]# ss -antl
State      Recv-Q     Send-Q              Local Address:Port         Peer Address:Port    Process     
LISTEN     0          128                       0.0.0.0:22                0.0.0.0:*                   
LISTEN     0          1              [::ffff:127.0.0.1]:8005                    *:*                   
LISTEN     0          80                              *:3306                    *:*                   
LISTEN     0          100                             *:8080                    *:*                   
LISTEN     0          128                             *:80                      *:*                   
LISTEN     0          128                          [::]:22                   [::]:*     

将下面四行取消注释

[root@localhost ~]# vim /etc/httpd24/httpd.conf 
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_connect_module modules/mod_proxy_connect.so
LoadModule proxy_http_module modules/mod_proxy_http.so
Include /etc/httpd24/extra/httpd-vhosts.conf

配置虚拟主机

[root@localhost httpd-2.4.43]# vim /etc/httpd24/extra/httpd-vhosts.conf 
<VirtualHost *:80>
    DocumentRoot "/usr/local/apache/htdocs"

    ProxyPass / http://192.168.207.131:8080/
    ProxyPassReverse / http://192.168.207.131:8080/
    <Directory "/usr/local/apache/htdocs">
        Options none
        AllowOverride none
        Require all granted
    </Directory>
</VirtualHost>


重启apache

[root@localhost ~]# apachectl restart

在这里插入图片描述

将下载好的jenkins.war放进tomcat/webapps目录下

[root@localhost webapps]# ls
docs  examples  host-manager  jenkins  jenkins.war  manager  ROOT

Jenkins

登入http://localhost:8080/jenkins,进入Jenkins初始化页面

image-20210615191618700

image-20210615191633632

image-20210615191737608

image-20210615191800290

image-20210615191808501

image-20210615191815910

image-20210615191825196

最后

以上就是任性泥猴桃为你收集整理的lamt部署和Jenkinslamt安装mysql安装tomcatJenkins的全部内容,希望文章能够帮你解决lamt部署和Jenkinslamt安装mysql安装tomcatJenkins所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(32)

评论列表共有 0 条评论

立即
投稿
返回
顶部