搭建开发环境

  1. 云栖社区>
  2. 博客>
  3. 正文

搭建开发环境

paascloud 2017-08-16 11:18:50 浏览545
展开阅读全文

搭建开发环境

1.ssh

[root@paascloud-test-001 ~]# yum -y install openssh*
[root@paascloud-test-001 ~]# systemctl stop firewalld.service
[root@paascloud-test-001 ~]# systemctl disable firewalld.service
[root@paascloud-test-001 ~]# systemctl start sshd.service
[root@paascloud-test-001 ~]# systemctl restart network.service

2.设置hostsname

[root@paascloud-test-001 ~]# hostnamectl set-hostname paascloud-test-001
[root@paascloud-test-001 ~]# hostnamectl set-hostname paascloud-test-002
[root@paascloud-test-001 ~]# hostnamectl set-hostname paascloud-test-003

[root@paascloud-test-001 tool]# vi /etc/hosts

192.168.241.151 paascloud-test-001
192.168.241.152 paascloud-test-002
192.168.241.153 paascloud-test-003

## 3.准备开发工具包

[root@paascloud-test-001 src]# pwd
/usr/local/src

-rw-r--r--. 1 root root   8534562 815 12:49 apache-maven-3.5.0-bin.tar.gz
-rw-r--r--. 1 root root      1790 815 08:26 initial-setup-ks.cfg
-rw-r--r--. 1 root root 169983496 815 12:49 jdk-8u131-linux-x64.rpm
-rw-r--r--. 1 root root  73187012 815 12:49 nexus-2.14.5-02-bundle.tar.gz
-rw-r--r--. 1 root root   1550261 815 12:49 redis-3.2.10.tar.gz
-rw-r--r--. 1 root root  22724574 815 12:49 zookeeper-3.4.9.tar.gz

[root@paascloud-test-001 src]# scp -r tool/ root@paascloud-test-002:/usr/local/src/
[root@paascloud-test-001 src]# scp -r tool/ root@paascloud-test-003:/usr/local/src/

4.安装开发环境

这里只展示第一台虚拟机的安装过程, 其他虚拟机类似

4.1 安装JDK

  • 安装
[root@paascloud-test-001 tool]#  rpm -ivh jdk-8u131-linux-x64.rpm
准备中...                          ################################# [100%]
正在升级/安装...
   1:jdk1.8.0_131-2000:1.8.0_131-fcs  ################################# [100%]
Unpacking JAR files...
    tools.jar...
    plugin.jar...
    javaws.jar...
    deploy.jar...
    rt.jar...
    jsse.jar...
    charsets.jar...
    localedata.jar...
  • 查看 jdk安装目录
[root@paascloud-test-001 tool]#  ls /usr/java/
default/      jdk1.8.0_131/ latest/
  • 配置环境变量
[root@paascloud-test-001 tool]# vi /etc/profile
JAVA_HOME=/usr/java/jdk1.8.0_131
JRE_HOME=/usr/java/jdk1.8.0_131/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@paascloud-test-001 tool]# source /etc/profile
[root@paascloud-test-001 tool]# echo $PATH
  • 查看jdk版本
[root@paascloud-test-001 tool]# java -version
openjdk version "1.8.0_141"
OpenJDK Runtime Environment (build 1.8.0_141-b16)
OpenJDK 64-Bit Server VM (build 25.141-b16, mixed mode)

4.2 安装MAVEN

  • 安装
[root@paascloud-test-001 tool]# tar -zxvf /usr/local/src/tool/apache-maven-3.5.0-bin.tar.gz -C /usr/local/
[root@paascloud-test-001 tool]# mv /usr/local/apache-maven-3.5.0/ /usr/local/maven
  • 配置环境变量
[root@paascloud-test-001 tool]# vi /etc/profile
#set maven environment
export M2_HOME=/usr/local/maven
export PATH=$M2_HOME/bin:$PATH
  • 查看版本号
[root@paascloud-test-001 tool]# source /etc/profile
[root@paascloud-test-001 tool]# mvn -version
Apache Maven 3.5.0 (ff8f5e7444045639af65f6095c62210b5713f426; 2017-04-04T03:39:06+08:00)
Maven home: /usr/local/maven
Java version: 1.8.0_131, vendor: Oracle Corporation
Java home: /usr/java/jdk1.8.0_131/jre
Default locale: zh_CN, platform encoding: UTF-8
OS name: "linux", version: "3.10.0-514.el7.x86_64", arch: "amd64", family: "unix"

4.3 安装MAVEN私服

由于版本3.x 第三方私服库必须使用命令, 而我本人较懒我这里使用的版本是nexus-2.14.5-02-bundle

  • 安装
[root@paascloud-test-001 tool]# mkdir /usr/local/nexus
[root@paascloud-test-001 tool]# tar -zxvf /usr/local/src/tool/nexus-2.14.5-02-bundle.tar.gz -C /usr/local/
[root@paascloud-test-001 tool]# mv /usr/local/nexus-2.14.5-02/ /usr/local/nexus

由于使用root用户 这里需要配置环境变量 否则会出现如下警告

[root@paascloud-test-001 tool]# /usr/local/nexus/nexus-2.14.5-02/bin/nexus start
****************************************
WARNING - NOT RECOMMENDED TO RUN AS ROOT
****************************************
If you insist running as root, then set the environment variable RUN_AS_USER=root before running this script.
  • 配置环境变量
[root@paascloud-test-001 tool]# vi /etc/profile
#set nexus environment
export RUN_AS_USER=root
  • 启动
[root@paascloud-test-001 tool]# /usr/local/nexus/nexus-2.14.5-02/bin/nexus start
[root@paascloud-test-001 tool]# /usr/local/nexus/nexus-2.14.5-02/bin/nexus status
****************************************
WARNING - NOT RECOMMENDED TO RUN AS ROOT
****************************************

http://192.168.241.151:8081/nexus 默认用户名密码 amdin admin123

  • 配置

这里写图片描述

settings.xml

<!--配置权限,使用默认用户-->
    <servers>
        <server>
            <id>nexus-releases</id>
            <username>admin</username>
            <password>admin123</password>
        </server>
        <server> 
            <id>nexus-snapshots</id>
            <username>admin</username>
            <password>admin123</password>
        </server>
    </servers>
    <profiles>
        <profile>
            <id>paascloud</id>
            <activation>
                <activeByDefault>true</activeByDefault>
                <jdk>1.8</jdk>
            </activation>
            <properties>
                <maven.compiler.source>1.8</maven.compiler.source>
                <maven.compiler.target>1.8</maven.compiler.target>
                <maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion>
            </properties>
            <repositories>
                <!-- 私有库地址-->
                <repository>
                    <id>nexus</id>
                    <url>http://192.168.241.151:8081/nexus/content/groups/public/</url>
                    <releases>
                        <enabled>true</enabled>
                    </releases>
                    <snapshots>
                        <enabled>true</enabled>
                    </snapshots>
                </repository>
                <repository>
                    <id>sonatype-nexus-staging</id>
                    <name>Sonatype Nexus Staging</name>
                    <url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
                    <releases>
                        <enabled>true</enabled>
                    </releases>
                    <snapshots>
                        <enabled>true</enabled>
                    </snapshots>
                </repository>
            </repositories>      
            <pluginRepositories>
                <!--插件库地址-->
                <pluginRepository>
                    <id>nexus</id>
                    <url>http://192.168.241.151:8081/nexus/content/groups/public/</url>
                    <releases>
                        <enabled>true</enabled>
                    </releases>
                    <snapshots>
                        <enabled>true</enabled>
                   </snapshots>
                </pluginRepository>
            </pluginRepositories>
        </profile>
    </profiles>
    <!--激活profile-->
    <activeProfiles>
        <activeProfile>paascloud</activeProfile>
    </activeProfiles>

4.4 安装docker

4.5 docker下安装mysql

[root@paascloud-test-001 tool]# docker pull index.tenxcloud.com/tenxcloud/mysql

docker run -d -p 3306:3306 -e MYSQL_PASS="123456" --restart=always --name mysql3306 index.tenxcloud.com/tenxcloud/mysql
ip 192.168.241.151 user: admin pwd: 123456

4.6 docker下安装redis

[root@paascloud-test-001 paascloud-master]# docker pull index.tenxcloud.com/tenxcloud/redis
[root@paascloud-test-001 paascloud-master]# docker run -d -p 6379:6379 -e REDIS_PASS="123456" --restart=always --name redis6379 index.tenxcloud.com/tenxcloud/redis

4.7 docker下安装rabbitmq

[root@paascloud-test-001 paascloud-master]# docker pull index.tenxcloud.com/tenxcloud/rabbitmq
[root@paascloud-test-001 paascloud-master]# docker run -d -p 5672:5672 -p 15672:15672 --restart=always -e RABBITMQ_PASS="123456" --name rabbitmq15672 index.tenxcloud.com/tenxcloud/rabbitmq
控制台地址: http://192.168.241.151:15672/ user: admin pwd:123456

4.8 安装nodeJs 8.3

https://nodejs.org/en/download/package-manager/

网友评论

登录后评论
0/500
评论
paascloud
+ 关注