导航:首页 > 编程语言 > centos65yumjava

centos65yumjava

发布时间:2024-04-23 18:07:19

linux怎么安装java环境

安装系统环境是: centos6.5 64位
一.安装jdk
1.下载Java文件jdk-6u45-Linux-x64.bin

2.运行./jdk-6u45-linux-x64.bin

3.移动该文件到/usr/local/jdk目录下
mv jdk-6u45-linux-x64 /usr/local/jdk

4.配置java环境变量,在文件/etc/profile最后添加以下内容:
#set java
JAVA_HOME=/usr/local/jdk;export JAVA_HOME
JRE_HOME=/usr/local/jdk/jre;export JRE_HOME
PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin;export PATH
export CLASSPATH=$CLASSPATH:$PATH:$JAVA_HOME/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib:$JRE_HOME/lib:.
5.source /etc/profile (重新激活)
6.运行java -version查看是否成功
二.安装tomcat
1.下载tomcat文件:apache-tomcat-7.0.47.tar.gz
2.解压tar -zxvf apache-tomcat-7.0.47.tar.gz
3.移动该文件到/usr/local下,并命名为tomcat
mv apache-tomcat-7.0.47 /usr/local/tomcat
4.到tomcat/bin目录下setclasspath.sh文件中设置java环境,加入以下两行即可:
export JAVA_HOME=/usr/local/jdk
export JRE_HOME=/usr/local/jdk/jre
5.设置tomcat 服务启动
把下面内容保存到/etc/init.d/目录,文件名为tomcat
#!/bin/bash
# /etc/rc.d/init.d/tomcat
# init script for tomcat precesses
#
# processname: tomcat by ton
# description: tomcat is a j2se server
# chkconfig: 2345 86 16
# description: Start up the Tomcat servlet engine.
set -m (有时不加这个,secureFX会话失效时,会导致tomcat自动stop)
CATALINA_HOME="/usr/local/tomcat"
if [ -f /etc/init.d/functions ]; then
. /etc/init.d/functions
elif [ -f /etc/rc.d/init.d/functions ]; then
. /etc/rc.d/init.d/functions
else
echo -e "/atomcat: unable to locate functions lib. Cannot continue."
exit -1
fi
# running tomcat services
RETVAL=$?
case "$1" in
start)
if [ -f $CATALINA_HOME/bin/startup.sh ];then
echo $"Starting Tomcat"
$CATALINA_HOME/bin/startup.sh
fi
;;
stop)
if [ -f $CATALINA_HOME/bin/shutdown.sh ];then
echo $"Stopping Tomcat"
$CATALINA_HOME/bin/shutdown.sh
fi
;;
restart)
if [ -f $CATALINA_HOME/bin/startup.sh ];then
echo $"Starting Tomcat"
$CATALINA_HOME/bin/startup.sh
fi
sleep 5
if [ -f $CATALINA_HOME/bin/shutdown.sh ];then
echo $"Stopping Tomcat"
$CATALINA_HOME/bin/shutdown.sh
fi
;;
*)
echo $"Usage: $0 {start|stop|restart}"
exit 1
;;
esac
exit $RETVAL

6.为该文件添加运行权限
chmod +x /etc/init.d/tomcat
三.安装MySQL
linux下主要是编译安装,需准备:cmake工具

1.yum install gcc gcc-c++ ncurses-devel perl (安装编译源码所需的工具和库)

2.下载cmake-3.0.1.tar.gz ,然后输入命令:

tar -xzvf cmake-3.0.1.tar.gz
cd cmake-3.0.1
./bootstrap ; make ; make install

3.新增mysql用户组和用户命令:
groupadd mysql
useradd -r -g mysql mysql

4.新建mysql安装目录和存放数据目录:
mkdir -p /usr/local/mysql
cd /usr/local/mysql
chown -R mysql:mysql . (分配权限)

mkdir -p /var/mysqldata
cd /var/mysqldata
chown -R mysql:mysql . (分配权限)

5.下载mysql-5.5.38.tar.gz ,解压:
tar -zxvf mysql-5.5.38.tar.gz
cd mysql-5.5.38(先进入目录下)

6.(先进入mysql-5.5.38目录下)再执行cmake命令:
cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
-DMYSQL_UNIX_ADDR=/var/mysqldata/mysql.sock \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_EXTRA_CHARSETS:STRING=utf8,gbk \
-DWITH_MYISAM_STORAGE_ENGINE=1 \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_MEMORY_STORAGE_ENGINE=1 \
-DWITH_READLINE=1 \
-DENABLED_LOCAL_INFILE=1 \
-DMYSQL_DATADIR=/var/mysqldata \
-DMYSQL_USER=mysql \
-DMYSQL_TCP_PORT=3306

7.再编译:
make
make install

8.复制配置文件,在/usr/local/mysql下执行:
cp support-files/my-medium.cnf /etc/my.cnf

9 初始化数据库
执行前需赋给scripts/mysql_install_db文件执行权限
chmod 755 scripts/mysql_install_db
scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql/ \
--datadir=/var/mysqldata/

10. 设置mysqld的开机启动
cp support-files/mysql.server /etc/init.d/mysql
chmod 755 /etc/init.d/mysql
chkconfig mysql on

11.MySQL配置环境变量
export PATH=/usr/local/mysql/bin:$PATH
alias mysql_start="mysqld_safe &"
alias mysql_stop="mysqladmin –u root -p shutdown"
source /etc/profile (重启配置)

12.启动mysql服务
/etc/init.d/mysql start

ps -ef |grep mysql (命令查看是否启动)

13. 登陆mysql
# mysql -u root –p
14.修改MySQL用户root的密码
mysqladmin -u root password '123456' (更新密码)

㈡ centos瀹夎卝ava鐨勯棶棰

鏄涓嶆槸涓嬭浇鐨勬枃浠舵牸寮忔湁闂棰橈紵
闇瑕佷笅杞界殑鏄疞inux self-extracting file鑰岄潪Linux RPM in self-extracting file锛屼綘鍐嶆鏌ヤ竴涓嬨
鍙浠ユ寜鐓т互涓嬫ラよ繘琛岋細
绗涓姝ワ細鏌ョ湅Linux鑷甯︾殑JDK鏄鍚﹀凡瀹夎 锛堝嵏杞絚entOS宸插畨瑁呯殑1.4锛
<1># rpm -qa|grep jdk 鈫 鏌ョ湅jdk鐨勪俊鎭鎴栫洿鎺ユ墽琛

# rpm -q jdk

# java -version
<2># rpm -qa | grep gcj 鈫 纭璁gcj鐨勭増鏈鍙
<3># yum -y remove java-1.4.2-gcj-compat 鈫 鍗歌浇gcj

绗浜屾ワ細瀹夎匤DK
<1>浠嶴UN涓嬭浇jdk-1_5_0_14-linux-i586-rpm.bin鎴杍dk-1_5_0_14-linux-i586.bin
鍦/usr涓嬫柊寤簀ava鏂囦欢澶癸紝灏嗗畨瑁呭寘鏀惧湪/usr/java鐩褰曚笅
# mkdir /usr/java
<2>瀹夎匤DK
# cd /usr/java
鈶爅dk-1_5_0_14-linux-i586-rpm.bin鏂囦欢瀹夎
# chmod 777 jdk-1_5_0_14-linux-i586-rpm.bin 鈫 淇鏀逛负鍙鎵ц
# ./jdk-1_5_0_14-linux-i586-rpm.bin 鈫 閫夋嫨yes鍚屾剰涓婇潰鐨勫崗璁
# rpm -ivh jdk-1_5_0_14-linux-i586.rpm 鈫 閫夋嫨yes鐩村埌瀹夎呭畬姣
鈶jdk-1_5_0_14-linux-i586.bin鏂囦欢瀹夎
# chmod a+x jdk-1_5_0_14-linux-i586.bin 鈫 浣垮綋鍓嶇敤鎴锋嫢鏈夋墽琛屾潈闄
# ./jdk-1_5_0_14-linux-i586.bin 鈫 閫夋嫨yes鐩村埌瀹夎呭畬姣

绗涓夋ワ細閰嶇疆鐜澧冨彉閲
<1># vi /etc/profile
<2>鍦ㄦ渶鍚庡姞鍏ヤ互涓嬪嚑琛岋細
export JAVA_HOME=/usr/java/jdk1.6.0_10
export CLASSPATH=.:$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$PATH:$JAVA_HOME/bin
<3># reboot 鈫 閲嶅惎鏈哄櫒閰嶇疆鐢熸晥

鎴戝湪鍋氱浜屼腑鏂囩綉http://dearzw.com寰楁椂鍊欎篃閬囪佽繃杩欎釜闂棰橈紝鎸夌収涓婇潰鐨勬ラゅ簲璇ュ氨OK浜嗐

阅读全文

与centos65yumjava相关的资料

热点内容
id为什么下载不得app 浏览:658
打印机扫描的文件路径怎么修改 浏览:876
编程在哪里做兼职 浏览:804
为什么总是复制隐藏文件 浏览:203
稳捷网络 浏览:908
网页打印保存pdf文件怎么打开 浏览:150
编译文件路径不能包含空格 浏览:44
linux打开文件系统检查失败 浏览:624
用什么网站能接室内翻新的活 浏览:235
三星手机应用程序许可 浏览:203
mh版本 浏览:288
编程猫幼儿园怎么样 浏览:50
公交app如何安装 浏览:692
iphone4耳机怎么用 浏览:605
学习课文的app有哪些 浏览:834
ios10导出文件到电脑 浏览:9
数控编程怎么编新程序 浏览:418
编程题怎么分解 浏览:998
本科生找工作应该学什么编程语言 浏览:803
android系统应用升级 浏览:55

友情链接