您的位置:首页 > 运维架构 > Tomcat

CentOS搭建java web运行环境(jdk + tomcat)

2016-09-02 00:00 501 查看
摘要: centos web环境

Virtualbox install additionaltools in centos6.8
When i checked the log file mention in the above screen, i see below error.

Creating udev rule for the Guest Additions kernel module.
/tmp/vbox.0/Makefile.include.header:97: *** Error: unable to find the sources of your current Linux kernel. Specify KERN_DIR=<directory> and run Make again. Stop.
Creating user for the Guest Additions.

To overcome this error update gcc using

1.yum update gcc

yum update

yum install kernel-uek-devel

*Please note that to execute “yum” your guest vmbox should have internet connection

now after doing all the above I again executed ./VMBoxLinuxAdditions.run

基于 CentOS-6.8-x86_64-minimal

安装SSH:

yum install ssh

启动SSH:

service sshd start

设置开机运行:

chkconfig sshd on

###修改163源
参考http://mirrors.163.com/.help/centos.html

###命令行和桌面方式启动
vi /etc/inittab

id:3:initdefault:

修改
图形界面 id: 5
命令行 id: 3
切换回图形界面

startx

###环境变量

- 方法一(所有用户的shell都有权使用这些环境变量)

/etc/profile 文件后面加上以下代码

export JAVA_HOME=/opt/jdk1.7.0_80
export PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/lib

执行

source /etc/profile

立即生效

- 方法二

把上面的代码附加到
/home/xxuser/.bash_profile # 用户目录下.bash_profile文件

###系统编码

修改 /etc/profile

export LANG=en_US.UTF-8
#export LANG=zh_CN.GBK

source /etc/profile 后生效
查看当前系统编码

#env |grep LANG

启动tomcat前 查看8080端口占用情况时
[root@localhost conf]# lsof -i:8080
-bash: lsof: command not found
安装lsof工具

yum install lsof

其他

zip工具默认也是没有的 安装

yum install -y unzip zip

####CentOS ssh超时设置
修改/etc/ssh/sshd_config文件
将ClientAliveInterval对应的0改成60 服务器端向客户端请求消息的时间间隔, 默认是0, 不发送
表示每分钟发送一次, 然后客户端响应, 这样就保持长连接了.
ClientAliveCountMax, 使用默认值3即可. 表示服务器发出请求后客户端没有响应的次数达到一定值, 就自动断开. 正常情况下, 客户端不会不响应

重新启动 sshd:
/etc/rc.d/init.d/sshd restart
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  CentOS java web