云服务器java开发环境搭建

1、jdk
https://blog.csdn.net/qq_31929761/article/details/81127272
2、mvn
maven安装过程与jdk基本一样
3、tomcat

//tomcat关闭报错 解决方法
Jul 17, 2015 9:47:54 AM org.apache.catalina.startup.Catalina stopServer 
SEVERE: Could not contact localhost:8005. Tomcat may not be running. 
Jul 17, 2015 9:47:54 AM org.apache.catalina.startup.Catalina stopServer 
SEVERE: Catalina.stop: 
java.net.ConnectException: Connection timed out 
at java.net.PlainSocketImpl.socketConnect(Native Method) 
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333) 
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195) 
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182) 
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366) 
at java.net.Socket.connect(Socket.java:525) 
at java.net.Socket.connect(Socket.java:475) 
at java.net.Socket.(Socket.java:372) 
at java.net.Socket.(Socket.java:186) 
at org.apache.catalina.startup.Catalina.stopServer(Catalina.java:498) 
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 
at java.lang.reflect.Method.invoke(Method.java:597) 
at org.apache.catalina.startup.Bootstrap.stopServer(Bootstrap.java:370) 
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:457)
--------------------- 
//修改$JAVA_HOME/jre/lib/security/Java.security 文件中 securerandom.source 配置项:
//将securerandom.source=file:/dev/random修改为:securerandom.source=file:/dev/urandom
//如果,仍然不生效,则修改为: file:/dev/./urandom

4、docker

#检查CentOS 系统的内核版本高于 3.10
uname -r
#移除旧的版本
sudo yum remove docker \
                  docker-client \
                  docker-client-latest \
                  docker-common \
                  docker-latest \
                  docker-latest-logrotate \
                  docker-logrotate \
                  docker-selinux \
                  docker-engine-selinux \
                  docker-engine
#安装一些必要的系统工具:
sudo yum install -y yum-utils device-mapper-persistent-data lvm2
#添加软件源信息:
sudo yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
#更新 yum 缓存:
sudo yum makecache fast
#安装 Docker-ce(Docer-ee是收费的):
sudo yum -y install docker-ce
#启动 Docker 后台服务
sudo systemctl start docker
#测试运行 hello-world
docker run hello-world
#删除 Docker CE
sudo yum remove docker-ce
sudo rm -rf /var/lib/docker

5、rabbitmq

#拉取镜像
docker pull rabbitmq:management
#运行镜像创建容器
docker run -d -p 5672:5672 -p 15672:15672 --name rabbitmq rabbitmq:management
#测试 端口号需要开放
http://[宿主机IP]:15672
用户名/密码  guest/guest

6、oracle
https://blog.csdn.net/qq_31929761/article/details/79641482
7、mysql

#拉取mysql镜像,采用网易加速地址
docker pull hub.c.163.com/library/mysql:5.7
#重命名镜像名
docker tag hub.c.163.com/library/mysql:5.7 mysql:5.7
#创建用于挂载的目录
sudo mkdir /my/mysql/datadir #用于挂载mysql数据文件
sudo mkdir /my/mysql/conf.d #用于挂载mysql配置文件
#使用镜像创建容器
docker run --name mysql5.7 -p 3306:3306 -v /my/mysql/datadir:/var/lib/mysql -v /my/mysql/conf.d:/etc/mysql/conf.d -e MYSQL_ROOT_PASSWORD=123456 -d mysql:5.7
#测试
mysql -h192.168.2.102 -p3306 -uroot -p

8、Nginx

#下载相关组件
wget http://nginx.org/download/nginx-1.10.2.tar.gz
wget http://www.openssl.org/source/openssl-fips-2.0.10.tar.gz
wget http://zlib.net/zlib-1.2.11.tar.gz
wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.40.tar.gz
#安装c++编译环境
yum install gcc-c++
#安装Nginx及相关组件
1)openssl安装
tar zxvf openssl-fips-2.0.10.tar.gz
cd openssl-fips-2.0.10
./config && make && make install
2)pcre安装
tar zxvf pcre-8.40.tar.gz
cd pcre-8.40
./configure && make && make install
3)zlib安装
tar zxvf zlib-1.2.11.tar.gz
cd zlib-1.2.11
./configure && make && make install
4)nginx安装
tar zxvf nginx-1.10.2.tar.gz
cd nginx-1.10.2
./configure && make && make install
#启动Nginx
whereis nginx #找到Nginx位置,nginx: /usr/local/nginx
/usr/local/nginx/sbin/nginx 
#如果报错了,error while loading shared libraries: libpcre.so.1: cannot open shared object file: No such file or directory
#用whereis libpcre.so.1命令找到libpcre.so.1在哪里。
#用ln -s /usr/local/lib/libpcre.so.1 /lib64命令做个软连接然后输入命令/usr/local/nginx/sbin/nginx 就可以了
#测试
ps -aux | grep nginx #查看进程是否存在
curl localhost #如果启动成功则会出现下面的html页面源码
<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
<style>
    body {
        width: 35em;
        margin: 0 auto;
        font-family: Tahoma, Verdana, Arial, sans-serif;
    }
</style>
</head>
<body>
<h1>Welcome to nginx!</h1>
<p>If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.</p>

<p>For online documentation and support please refer to
<a href="http://nginx.org/">nginx.org</a>.<br/>
Commercial support is available at
<a href="http://nginx.com/">nginx.com</a>.</p>

<p><em>Thank you for using nginx.</em></p>
</body>
</html>
#Nginx常用命令
/usr/local/nginx/sbin/nginx #启动
/usr/local/nginx/sbin/nginx -s stop(quit、reload) #停止/重启
/usr/local/nginx/sbin/nginx -h #命令帮助
/usr/local/nginx/sbin/nginx -t #验证配置文件
vim /usr/local/nginx/conf/nginx.conf #配置文件

9、redis

#拉取镜像
docker pull  redis:3.2
#创建容器
docker run -p 6379:6379 -v $PWD/data:/data  -d redis:3.2 redis-server --appendonly yes
#命令说明:
-p 6379:6379 : 将容器的6379端口映射到主机的6379端口
-v $PWD/data:/data : 将主机中当前目录下的data挂载到容器的/data
redis-server --appendonly yes : 在容器执行redis-server启动命令,并打开redis持久化配置
#测试,进入容器并执行redis-cli命令 43f7a65ec7f8指的是redis容器id
docker exec -it 43f7a65ec7f8 redis-cli

你可能感兴趣的:(java,基础,linux,mysql,docker,oracle,nginx)