阿里云Linux下安装JDK+Tomcat+Orcale+ActiveMQ+Redius等项目部署与发布环境

Linux部署

安装lrzsz

  1. 安装lrzsz: yum -y install lrzsz
  2. 进入tmp目录
  3. rz 上传安装文件
    jdk-8u65-linux-x64.tar.gz
    apache-tomcat-8.0.28.tar.gz
    oracle-xe-11.2.0-1.0.x86_64.rpm.zip
    redis-3.2.4.tar.gz
    apache-activemq-5.14.0-bin.tar.gz
    elasticsearch-2.4.0.tar.gz

安装JDK

  1. 解压 JDK: tar -zxvf jdk-8u65-linux-x64.tar.gz .
    1、*.tar 用 tar –xvf 解压
    2、*.gz 用 gzip -d或者gunzip 解压
    3、.tar.gz和.tgz 用 tar –xzf 解压
    4、*.bz2 用 bzip2 -d或者用bunzip2 解压
    5、*.tar.bz2用tar –xjf 解压
    6、*.Z 用 uncompress 解压
    7、*.tar.Z 用tar –xZf 解压
    8、*.rar 用 unrar e解压
    9、*.zip 用 unzip 解压

  2. 将安装目录移动到 /usr下
    mv ./jdk1.8.0_65/ /usr/

  3. 创建链接简化目录操作
    ln -s /usr/jdk1.8.0_65/ /usr/jdk

  4. 编辑环境变量path 、JAVA_HOME
    vi /etc/profile

    在文件末尾添加
    JAVA_HOME=/usr/jdk
    export CLASSPATH=.: JAVAHOME/libexportPATH= J A V A H O M E / l i b e x p o r t P A T H = JAVA_HOME/bin:$PATH

:wq 退出
重启 shutdown -r now (source /etc/profile )

Linux安装jdk1.8时走到最后一步,检查jdk配置是否生效时,突然碰出一个问题来。

提示:bash: /usr/java/jdk1.8/bin/java: 权限不够

解决

这时需要Linux连接Xshell,在Xshell中

输入命令:chmod +x /usr/java/jdk1.8/bin/java

注:

  1. chmod:改变权限的方法

  2. +:代表添加权限

  3. x:代表执行权限

  4. /usr/java/jdk1.8/bin/java:文件名(你的文件名是什么就在chmod +x 后直接添加什么就OK了)

dd 删除行 , i 添加内容 , x删除当前字符
:wq 保存
:q! 不保存


## 安装Tomcat服务器 
1. 解压tomcat到opt目录 
   tar -zxvf apache-tomcat-8.0.28.tar.gz -C /opt
2. 创建链接简化目录操作 
   ln -s /opt/apache-tomcat-8.0.28 /opt/tomcat
3. 启动tomcat 
   /opt/tomcat/bin/start.sh
4. 自动开机启动 

1、编辑startup.sh

chkconfig: 2345 80 90

description:tomcat auto start

processname: tomcat

2、编辑catalina.sh
./export 搜索
export JAVA_HOME = /usr/jdk
export CATALINA_BASE=/opt/tomcat
export CATALINA_HOME=/opt/tomcat
export CATALINA_TMPDIR=/opt/tomcat/temp

3、link start.sh 到 /etc/init.d/tomcat
ln -s /opt/tomcat/bin/startup.sh /etc/init.d/tomcat

3、添加服务
chkconfig –add tomcat
chkconfig tomcat on


## 安装Oracle数据库 
1. 解压zip安装包: unzip oracle-xe-11.2.0-1.0.x86_64.rpm.zip 
2. 进入 Disk1,安装oracle11g xe
   rpm -ivh oracle-xe-11.2.0-1.0.x86_64.rpm
备注: 卸载 rpm -e --nodeps oracle-xe-11.2.0-1.0.x86_64
3. /etc/init.d/oracle-xe文件中是有包含Oracle环境变量的一些参数的,我们只需要从中复制中其中的 ORALCE_HOME,ORALCE_BASE,PATH,ORALCE_SID 到 /etc/profile 中  
   export ORACLE_HOME=/u01/app/oracle/product/11.2.0/xe
   export ORACLE_SID=XE
   export ORACLE_BASE=/u01/app/oracle
   export PATH=$ORACLE_HOME/bin:$PATH
   LSNR=$ORACLE_HOME/bin/lsnrctl
   SQLPLUS=$ORACLE_HOME/bin/sqlplus
   ORACLE_OWNER=oracle
4. :wq 保存退出, 输入命令: source /etc/profile  
5. 完成数据库配置 /etc/init.d/oracle-xe configure 
6. 自动开机启动 chkconfig oracle-xe on 

错误 :ORA-00130: invalid listener address '(ADDRESS=(PROTOCOL=TCP)(HOST=host-10-0-0-10)(PORT=1521))'
解决: 配置/etc/hosts 文件 
127.0.0.1   host-10-0-0-10 

## 创建oracle账号 bos 、crm 
- 创建bos、crm账号

- bos、crm 账户锁定解决
alter user bos account unlock;
alter user bos identified by bos;

alter user crm account unlock;
alter user crm identified by crm;

## 安装redis
1. 安装gcc 
   yum install -y gcc g++ gcc-c++ make
2. 下载解压 redis 
   wget http://download.redis.io/releases/redis-3.0.0.tar.gz
   tar zxvf redis-3.0.0.tar.gz
   cd redis-3.0.0
3. 进入redis目录,执行make 
   make MALLOC=libc 
4. 启动 关闭 redis 
   - 启动redis
   src/redis-server &
   - 关闭redis
   src/redis-cli shutdown
5. redis 开机启动 
创建链接 ln -s /usr/redis.3.0.0 /usr/redis 
修改 redis.config 

daemonize yes

vi /etc/init.d/redis 

chkconfig: 2345 10 90

description: Start and Stop redis

PATH=/usr/local/bin:/sbin:/usr/bin:/bin
REDISPORT=6379
EXEC=/usr/redis/src/redis-server
REDIS_CLI=/usr/redis/src/redis-cli

PIDFILE=/var/run/redis.pid
CONF=”/use/redis/redis.conf”
AUTH=”1234”

case “ 1instart)if[f 1 ” i n s t a r t ) i f [ − f PIDFILE ]
then
echo “ PIDFILEexists,processisalreadyrunningorcrashed.elseechoStartingRedisserver P I D F I L E e x i s t s , p r o c e s s i s a l r e a d y r u n n i n g o r c r a s h e d . ” e l s e e c h o “ S t a r t i n g R e d i s s e r v e r … ” EXEC CONFfiif[ C O N F f i i f [ “ ?”=”0” ]
then
echo “Redis is running…”
fi
;;
stop)
if [ ! -f PIDFILE]thenecho P I D F I L E ] t h e n e c h o “ PIDFILE exists, process is not running.”
else
PID= (cat ( c a t PIDFILE)
echo “Stopping…”
REDISCLIp R E D I S C L I − p REDISPORT SHUTDOWN
sleep 2
while [ -x PIDFILE]doechoWaitingforRedistoshutdownsleep1doneechoRedisstoppedfi;;restart|forcereload) P I D F I L E ] d o e c h o “ W a i t i n g f o r R e d i s t o s h u t d o w n … ” s l e e p 1 d o n e e c h o “ R e d i s s t o p p e d ” f i ; ; r e s t a r t | f o r c e − r e l o a d ) {0} stop
${0} start
;;
*)
echo “Usage: /etc/init.d/redis {start|stop|restart|force-reload}” >&2
exit 1
esac

6、 启动redis 关闭redis 服务 
- 尝试启动或停止redis
service redis start
service redis stop
- 开启服务自启动
chkconfig redis on

## 安装activeMQ 
1. 解压 activeMQ 
   tar -zxvf apache-activemq-5.14.0-bin.tar.gz
2. 复制activeMQ 到 usr目录 
   mv apache-activemq-5.14.0 /usr
3. 进入activeMQ的bin目录 
   ./activemq start
4. 查看端口 是否启动 
   netstat -an | grep 61616
5. 创建链接 ln -s /usr/apache-activemq-5.14.0/ /usr/activemq
6. 复制启动文件 cp /usr/activemq/bin/activemq /etc/init.d
7. 编辑 /etc/init.d/activemq 

在第二行添加
BEGIN INIT INFO

Provides: activemq

Required-Start: remotefs r e m o t e f s syslog

Required-Stop: remotefs r e m o t e f s syslog

Default-Start: 2 3 4 5

Default-Stop: 0 6

chkconfig: 2345 64 36

Short-Description: ActiveMQ server

END INIT INFO


在最后一个#后添加

export JAVA_HOME=/usr/jdk
ACTIVEMQ_HOME=/usr/activemq

8. 添加到系统服务 
chkconfig --add activemq 
chkconfig activemq on 

## 安装elasticSearch 
1. 解压  tar -zxvf elasticsearch-2.4.0.tar.gz  
2. 移动到usr目录 mv elasticsearch-2.4.0/ /usr/
3. 改名为elasticsearch:  mv elasticsearch-2.4.0 elasticsearch
4. 运行elasticSearch 
   /usr/elasticsearch/bin/elasticsearch -d
   `使用root运行 -Des.insecure.allow.root=true`
5. 外网访问
   修改配置文件 config/elasticsearch.yml
   network.host: 0.0.0.0
6. 安装 es head插件 
   进入bin目录
   ./plugin install mobz/elasticsearch-head
7. 安装ik分词器 
   rz 上传 elasticsearch-analysis-ik-2.x.zip 
   - 进入target/release目录 
   拷贝文件到 %es%/plugins/analysis-ik
    `cp -r ./ /usr/elasticsearch/plugins/analysis-ik/`
   - 进入target/release/config 目录
   将所有配置文件,复制 %es%/config 下
    `cp -r ./ /usr/elasticsearch/config/ `
   - 配置elasticsearch.yml
   加入 index.analysis.analyzer.ik.type: "ik"
   - 访问
   http://ip:9200/_analyze?analyzer=ik&pretty=true&text=我是中国人

8. 服务自启动 
   进入/etc/init.d 编写脚本 
   vi elasticsearch 

!/bin/bash

chkconfig:2345 80 05

description:elasticsearch service

RETVAL=0
start(){
export JAVA_HOME=/usr/jdk
echo -n “start elasticsearch”
cd /usr/elasticsearch/
bin/elasticsearch -d -Des.insecure.allow.root=true
}
stop(){
echo “elasticsearch service is stoped…”
}
case 1instart)start;;stop)stop;;esacexit 1 i n s t a r t ) s t a r t ; ; s t o p ) s t o p ; ; e s a c e x i t RETVAL
“`
8. 添加到系统服务
chkconfig –add elasticsearch
chkconfig elasticsearch on

Oracle 错误

  • ORA-01089: immediate shutdown in progress - no operations are permitted
    今天shutdown immediate关数据库的时候出现ORA-01089: immediate shutdown in progress - no operations are permitted的错误。
    ps -ef|grep ora_发现oracle的各个后台进程仍然在运行着,说明数据库没有关闭成功。
    解决方法如下:
    先exit退出,重新登录:
    [oracle@localhost trace]$ sqlplus /nolog
    SQL>conn /as sysdba
    Connected to an idle instance.
    接着,使用shutdown abort强制关闭数据库:
    SQL>shutdown abort;
    ORACLE instance shut down.
    最后,使用startup force打开数据库:
    SQL>startup force;
    ORACLE instance started.

Total System Global Area 849530880 bytes
Fixed Size 1339824 bytes
Variable Size 641732176 bytes
Database Buffers 201326592 bytes
Redo Buffers 5132288 bytes
Database mounted.
Database opened.

打开数据库之后,再次使用shutdown immediate关闭数据库:
SQL>shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
问题解决。

  • ORA-00020:maximum number of processes (150) exceeded 错误解决方法
    SQL> conn sys/123456 as sysdba ;
    SQL> show parameter processes;

NAME TYPE VALUE

aq_tm_processes integer 1
db_writer_processes integer 1
job_queue_processes integer 10
log_archive_max_processes integer 1
processes integer 150

一看怎么已经改了,依然是150,后来通过网上看到,单纯的改配置文件无效,而后就通过以下sql进行了修改

SQL> alter system set processes=500 scope = spfile;

done;

SQL> create pfile from spfile;

done;

这里执行时间有可能会提示权限不足,这个时间用dba权限即可

然后重启数据库,再次show,已经修改成了500

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值