虚拟服务器搭建

 (一)   需要安装的软件

a)         apache-ant-1.7.1

b)         apache-maven-3.0

c)         httpd1.341.tar.gz

d)         jboss-4.2.2.GA.zip

e)         jrrt-4.0.1-1.6.0-linux-x64.bin

f)          ojdbc6.jar

g)         jboss.sh(启动jboss用的, 从别的服务器拷来的)

(二)   创建用户(root用户操作)

useradd jboss

passwd jboss

(三)   上传软件包(jboss用户操作,可选操作)

a)         mkdir  /home/jboss/soft

b)         进入sftp模式

c)         lcd  C:\Users\nf\Desktop\linux软件(不是标准操作)

d)         cd /home/jboss/soft/

e)         put –r  *

(四)   安装jboss(jboss用户操作)

a)         unzip  /home/jboss/soft/jboss-4.2.2.GA.zip  -d /home/jboss/

b)         cp /home/jboss/soft/jboss.sh/home/jboss/jboss-4.2.2.GA/bin/

c)         配置数据源

vi /home/jboss/jboss-4.2.2.GA/server/default/deploy/oracle-ds.xml

加入以下值

<no-tx-datasource>

<jndi-name>lottery_228</jndi-name>

<connection-url>jdbc:oracle:thin:@192.168.0.229:1521:ora11g</connection-url>

<driver-class>oracle.jdbc.OracleDriver</driver-class>

<user-name>lottery_228</user-name>

<password>WRpgnv</password>

<min-pool-size>5</min-pool-size>

<max-pool-size>20</max-pool-size>

<blocking-timeout-millis>3000</blocking-timeout-millis>

</no-tx-datasource>

 

<no-tx-datasource>

<jndi-name>b2b_228</jndi-name>

<connection-url>jdbc:oracle:thin:@192.168.0.229:1521:ora11g</connection-url>

<driver-class>oracle.jdbc.OracleDriver</driver-class>

<user-name>b2b_228</user-name>

<password>VKsmy8</password>

<min-pool-size>5</min-pool-size>

<max-pool-size>20</max-pool-size>

<blocking-timeout-millis>3000</blocking-timeout-millis>

</no-tx-datasource>

d)         修改limits.conf文件增加以下参数值

vi /etc/security/limits.conf

 

jboss              soft    nproc   2047

jboss              hard    nproc   16384

jboss              soft    nofile  1024

jboss              hard    nofile  65536

e)         配置jboss开机自动启动

a)         cd  /etc/init.d

b)         cp /home/jboss/jboss-4.2.2.GA/bin/jboss.sh /etc/init.d/jboss

c)         chmod +x /etc/init.d/jboss

d)         chkconfig --add jboss

e)         chkconfig –list|grep httpd (查看是否正常)

[root@test7 init.d]# chkconfig --list | grep jboss

jboss           0:off   1:off   2:off   3:on    4:on    5:on    6:off

(五)   安装jdk(root用户操作)

a)         cp /home/jboss/soft

b)         chmod +x jrrt-4.0.1-1.6.0-linux-x64.bin

c)         ./jrrt-4.0.1-1.6.0-linux-x64.bin

Welcome:  直接回车

Choose Product Installation Directory: 输入安装路径/usr/java/jrrt-4.0.1-1.6.0/

Choose Product Installation Directory:输入Next

往后一直回车就行了

d)         cp /home/jboss/soft/ojdbc6.jar /usr/java/jrrt-4.0.1-1.6.0/jre/lib/ext/

(六)   ant maven安装(root用户操作)

a)         cp -rf /home/jboss/soft/apache-ant-1.7.1/ /home/

b)         cp -rf /home/jboss/soft/apache-maven-3.0/ /home/

c)         chmod +x /home/apache-ant-1.7.1/bin/ant

(七)   配置环境变量(Jboss用户).bash_profile

a)         cd  ~

b)         vi .bash_profile

JAVA_HOME=/usr/java/jrrt-4.0.1-1.6.0

JBOSS_HOME=/home/jboss/jboss-4.2.2.GA

ANT_HOME=/home/apache-ant-1.7.1

MAVEN_HOME=/home/apache-maven-3.0

 

JAVA_OPTS=' -Xmx1024m -Xms512m -XX:PermSize=64m -XX:MaxPermSize=256m -Djava.awt.headless=true -Djava.io.tmpdir=/var/tmp -Xmanagement:ssl=false,authenticate=false,autodiscovery=true -Djava.rmi.server.hostname=192.168.0.228'

PATH=$ANT_HOME/bin:$HOME/bin:$MAVEN_HOME/bin:$JAVA_HOME/bin:$PATH

LANG=zh_CN

export PATH JAVA_HOME JBOSS_HOME ANT_HOME MAVEN_HOME JAVA_OPTS LANG

unset USERNAME

 

if [ $USER = "jboss" ]; then

  if [ $SHELL = "/bin/ksh" ]; then

    ulimit -p 16384

    ulimit -n 65536

  else

    ulimit -u 16384 -n 65536

  fi

fi

(八)   创建源码文件夹

 

a)         mkdir /home/jboss/work/

(九)   配置apache(root用户操作)

a)         gzip -d httpd1.341.tar.gz

b)         tar xvf httpd1.341.tar

c)         cp -rf /home/jboss/soft/httpd1.341 /etc/

d)         配置/etc/init.d/启动httpd1.1341

a)         cd /etc/init.d

b)         scp  -P42001  [email protected]:/etc/init.d/httpd  .  (密码joyveb@com)

e)         service httpd start

如果apache启动报以下错误

[root@test7 init.d]# service httpd start

/etc/httpd1.341/bin/httpd: error while loading shared libraries: libm.so.6: cannot open shared object file: No such file or directory

/etc/init.d/httpd start: httpd could not be started

 

解决方案yum install libm.so.6

 

[root@test7 yum.repos.d]# service httpd start

/etc/init.d/httpd: /etc/httpd1.341/bin/httpd: /lib/ld-linux.so.2: bad ELF interpreter: No such file or directory

/etc/init.d/httpd start: httpd could not be started

 

解决方案scp  -P42001  [email protected]:/lib/ld-linux.so.2 /lib/ld-linux.so.2

 

[root@test7 lib]# service httpd start

/etc/httpd1.341/bin/httpd: error while loading shared libraries: libgdbm.so.2: cannot open shared object file: No such file or directory

/etc/init.d/httpd start: httpd could not be started

[root@test7 lib]# yum install libgdbm.so.2

 

[root@test7 lib]# service httpd start

/etc/httpd1.341/bin/httpd: error while loading shared libraries: libexpat.so.0: cannot open shared object file: No such file or directory

/etc/init.d/httpd start: httpd could not be started

解决方案yum install libexpat.so.0

 

 

 

 

有时候mvn下包下的太慢可以直接把别的服务器把所有的jar全部拷来。当ant项目失败报“XXX”包下载失败的时候也可以采用此办法试试

cd  /home/jboss/.m2/

scp -r -P40004 [email protected]:/home/jboss/.m2/repository/ .

 

 

root

pkill -HUP httpd重新加载apache

pgrep httpd        查看apache进程

service httpd start  启动apache

service httpd stop关闭apache

 

 

查看apache访问日志

vi /etc/httpd1.341/logs/access_log*

 

 

你可能感兴趣的:(jboss,职场,httpd,休闲,虚拟服务器)