centos单机安装nginx、gitlab、nexus、mysql共存

思路就是不同系统设不同端口号,通过nginx做反向代理绑定不同域名。

 

nginx 安装

1、安装pcre软件包(使nginx支持http rewrite模块)
yum install -y pcre
yum install -y pcre-devel

2、安装openssl(使nginx支持ssl)
yum install -y openssl-devel

3、创建用户
groupadd nginx
useradd -g nginx nginx

3、安装nginx
[root@localhost nginx-1.11.2]# ./configure
--group=nginx
--user=nginx
--prefix=/usr/local/nginx
--pid-path=/var/run/nginx.pid \
--lock-path=/var/lock/nginx
--with-http_stub_status_module
--with-http_ssl_module
--with-http_gzip_static_module
--with-pcre
[root@localhost nginx-1.11.2]# make &&make install

java jdk 安装

1、下载jdk 1.8 rpm版
wget http://download.oracle.com/otn-pub/java/jdk/8u131-b11/d54c1d3a095b4ff2b6607d096fa80163/jdk-8u131-linux-x64.rpm?AuthParam=1498115333_37339e0bf2e86e03fe12a60f9ab41687

2、安装
rpm -ivh jdk-8u131-linux-x64.rpm

3、配置环境变量
vi /etc/profile
加入如下内容
JAVA_HOME=/usr/java/jdk1.8.0_25
JRE_HOME=/usr/java/jdk1.8.0_25/jre
PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin
CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib
export JAVA_HOME JRE_HOME PATH CLASSPATH
使修改生效
[root@localhost ~]# source /etc/profile //使修改立即生效
[root@localhost ~]# echo $PATH //查看PATH值

gitlab 安装

1、rpm方式安装gitlab
[root@localhost src]# rpm -i gitlab-ce-8.7.0-ce.0.el7.x86_64.rpm

2、初始化
[root@localhost bin]# /opt/gitlab/bin/gitlab-ctl reconfigure

3、修改gitlab默认的nginx端口号
[root@localhost conf]# vim /var/opt/gitlab/nginx/conf/gitlab-http.conf
[root@localhost conf]# /opt/gitlab/bin/gitlab-ctl restart

4、修改code网址
[root@localhost gitlab]# vim /opt/gitlab/embedded/service/gitlab-rails/config/gitlab.yml
[root@localhost gitlab]# /opt/gitlab/bin/gitlab-ctl restart


maven私有仓储nexus 安装
1、下载
wget https://sonatype-download.global.ssl.fastly.net/nexus/3/nexus-3.3.2-02-unix.tar.gz

2、安装
解压使用

3、启动
./bin/nexus run &
默认端口8081
默认帐号密码 admin/admin123

MySQL安装

1、安装依懒包
yum -y install make gcc-c++ cmake bison-devel ncurses-devel

2、编译安装
cmake \
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
-DMYSQL_DATADIR=/usr/local/mysql/data \
-DSYSCONFDIR=/etc \
-DWITH_MYISAM_STORAGE_ENGINE=1 \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_MEMORY_STORAGE_ENGINE=1 \
-DWITH_READLINE=1 \
-DMYSQL_UNIX_ADDR=/var/lib/mysql/mysql.sock \
-DMYSQL_TCP_PORT=3306 \
-DENABLED_LOCAL_INFILE=1 \
-DWITH_PARTITION_STORAGE_ENGINE=1 \
-DEXTRA_CHARSETS=all \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci

make && make install

3、创建组用户
groupadd mysql
useradd -g mysql mysql

4、修改目录权限
chown -R mysql:mysql /usr/local/mysql/
chown -R mysql:mysql /var/data/mysql

5、初始化
cd /usr/local/mysql
scripts/mysql_install_db --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --user=mysql

6、添加服务启动
cp support-files/mysql.server /etc/init.d/mysql
chkconfig mysql on
service mysql start --启动MySQL

7、增加本地mysql环境变量
修改/etc/profile文件,在文件末尾添加
PATH=/usr/local/mysql/bin:$PATH
export PATH

关闭文件,运行下面的命令,让配置立即生效
source /etc/profile

8、登录并设置密码、开启远程访问
mysql -uroot
mysql> SET PASSWORD = PASSWORD('123456');
mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'172.16.%' IDENTIFIED BY 'password' WITH GRANT OPTION;

posted @ 2017-07-18 14:25  Assion Yang  阅读(601)  评论(0编辑  收藏  举报