Linux 软件安装(jdk,tomcat,nginx,mysql,svn)

Posted alex-zqzy

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Linux 软件安装(jdk,tomcat,nginx,mysql,svn)相关的知识,希望对你有一定的参考价值。

 

安装软件的方式:

  源码安装 (Nginx,redis等)

  rpm(redhat package manager)包安装 (mysql等)

  yum安装(需要联网)

  binary类型软件安装(这种类型的软件,首先从官网下载到本地,然后解压即可使用,例如jdk,tomcat)

 

jdk安装:

#1,指定两个目录
mkdir -p /export/servers
mkdir -p /export/software


#2,上传jdk安装包到linux

sz 命令

#解压
 tar -zxvf jdk-8u141-linux-x64.tar.gz -C /export/servers/
 
 which java 
 
 [[email protected] jdk1.8.0_141]# which java
/usr/bin/java
[[email protected] jdk1.8.0_141]# 


#3,卸载自带的jdk

#3.1、找到自带的jdk

 rpm -qa |grep java
 
 [[email protected] jdk1.8.0_141]# rpm -qa |grep java
java-1.6.0-openjdk-1.6.0.41-1.13.13.1.el6_8.x86_64
tzdata-java-2016j-1.el6.noarch
java-1.7.0-openjdk-1.7.0.131-2.6.9.0.el6_8.x86_64
[[email protected] jdk1.8.0_141]# 


#3.2、卸载
命令:
rpm -e --nodeps 
java-1.6.0-openjdk-1.6.0.41-1.13.13.1.el6_8.x86_64 
tzdata-java-2016j-1.el6.noarch 
java-1.7.0-openjdk-1.7.0.131-2.6.9.0.el6_8.x86_64

#3.3、安装新的jdk 1.8 配置环境变量

vi /etc/profile 

#JAVA_HOME SET
export JAVA_HOME=/export/servers/jdk1.8.0_141
export PATH=$PATH:$JAVA_HOME/bin


#3.4让环境变量生效
 source /etc/profile
 
#3.5验证配置的是否正确
 
 [[email protected] jdk1.8.0_141]# java -version

java version "1.8.0_141"
Java(TM) SE Runtime Environment (build 1.8.0_141-b15)
Java HotSpot(TM) 64-Bit Server VM (build 25.141-b15, mixed mode)
[[email protected] jdk1.8.0_141]# 



分发文件(把jdk的文件分发到其他机器)
方式一
 scp -r jdk1.8.0_141/ [email protected]:/export/servers/
方式二
 scp -r jdk1.8.0_141/ [email protected]:$PWD 【cd /export/servers/】

 

tomcat安装:

1、上传(window上传到linux)
2、解压

tar -zxvf apache-tomcat-7.0.57.tar.gz -C /export/servers/

3、启动tomcat
进入目录:cd  /export/servers/apache-tomcat-7.0.57/bin

./startup.sh

4、验证是否启动
[[email protected] bin]# netstat -nltp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address               Foreign Address             State       PID/Program name   
tcp        0      0 0.0.0.0:111                 0.0.0.0:*                   LISTEN      1352/rpcbind             
tcp        0      0 :::111                      :::*                        LISTEN      1352/rpcbind        
tcp        0      0 :::8080                     :::*                        LISTEN      2876/java           
tcp        0      0 :::22                       :::*                        LISTEN              
[[email protected] bin]# 


5、jps查看tomcat的服务进程名字及pid
[[email protected] bin]# jps
2902 Jps
2876 Bootstrap
[[email protected] bin]# 

6、windows浏览器中通过URL进行访问即可

http://node-01:8080/

7、关闭(停止)tomcat

./shutdown.sh

 

Nginx安装:

安装依赖环境:

 yum install gcc-c++
 
 yum install -y pcre pcre-devel
 
 yum install -y zlib zlib-devel
 
 yum install -y openssl openssl-devel

安装:

mkdir -p /var/temp/nginx

./configure --prefix=/usr/local/nginx --pid-path=/var/run/nginx/nginx.pid --lock-path=/var/lock/nginx.lock --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --with-http_gzip_static_module --http-client-body-temp-path=/var/temp/nginx/client --http-proxy-temp-path=/var/temp/nginx/proxy --http-fastcgi-temp-path=/var/temp/nginx/fastcgi --http-uwsgi-temp-path=/var/temp/nginx/uwsgi --http-scgi-temp-path=/var/temp/nginx/scgi

#然后执行:

make 

make install 

#开启
cd /usr/local/nginx

cd sbin(nginx)

./nginx

#校验
netstat -nltp

[[email protected] sbin]# netstat -nltp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address               Foreign Address             State       PID/Program name   
tcp        0      0 0.0.0.0:111                 0.0.0.0:*                   LISTEN      1352/rpcbind        
tcp        0      0 0.0.0.0:80                  0.0.0.0:*                   LISTEN      5979/nginx          
tcp        0      0 0.0.0.0:35187               0.0.0.0:*                   LISTEN      1374/rpc.statd      
tcp        0      0 0.0.0.0:22                  0.0.0.0:*                   LISTEN       



浏览器进行访问
http://node-01:80

#停止命令
kill -9 5979

 

mysql的安装:

1、上传、解压

2、检查是否安装了mysql

rpm -qa |grep mysql

3、卸载mysql软件
rpm -e --nodeps mysql-libs-5.1.71-1.el6.x86_64

4、安装
rpm  -ivh  *.rpm

5、启动mysql服务
service mysql start

6、查看mysql初始化自带的密码
 cat /root/.mysql_secret
 
7、mysql -uroot -p
pasword:

8、修改密码
mysql>SET PASSWORD = PASSWORD(‘123456‘);

9、设置系统启动时候自动启动mysql
chkconfig --add mysql
chkconfig mysql on

10、检查列表中是否已经添加了,主要是进行校验
chkconfig

11、授权(注意别忘记这一步,不然sqlyog连不上)
grant all privileges on *.* to ‘root‘ @‘%‘ identified by ‘123456‘; 
flush privileges;

 

svn安装:

1、通过yum命令进行在线安装
yum install subversion 

2、创建svn版本库目录
mkdir  -p  /opt/svnFile

3、修改配置文件

a、vim svnserve.conf

anon-access = read
auth-access = write
password-db = passwd
authz-db = authz

#账号
b、vim passwd 

zhangsan = 123456
lisi = 123456
wangwu = 123456
zhaoliu = 123456
zhaosi = 123456

c、vim authz

[aliases]
# joe = /C=XZ/ST=Dessert/L=Snake City/O=Snake Oil, Ltd./OU=Research Institute/CN=Joe Average

[groups]
# harry_and_sally = harry,sally
# harry_sally_and_joe = harry,sally,&joe

admin = zhangsan,lisi,wangwu,zhaoliu

# [/foo/bar]
# harry = rw
# &joe = r
# * =

# [repository:/baz/fuz]
# @harry_and_sally = rw
# * = r


[/]
@admin = rw
zhaosi = r
* =

 

以上是关于Linux 软件安装(jdk,tomcat,nginx,mysql,svn)的主要内容,如果未能解决你的问题,请参考以下文章

linux下安装jdk,tomcat以及mysql

软件安装(JDK+MySQL+TOMCAT)

Linux:Jdk及Tomcat软件安装方式

linux-jdk-mysql-tomcat安装

Linux_软件安装_jdk_tomcat_Mysql

Linux上jdk,mysql,tomcat安装