OpenVZ:修订间差异
来自Ubuntu中文
跳到导航跳到搜索
第7行: | 第7行: | ||
cp /etc/resolv.conf /etc/resolv.masqdns | cp /etc/resolv.conf /etc/resolv.masqdns | ||
echo "nameserver 127.0.0.1" > /etc/resolv.conf | echo "nameserver 127.0.0.1" > /etc/resolv.conf | ||
chkconfig dnsmasq on | |||
service dnsmasq start | |||
== 安装 openvz == | == 安装 openvz == |
2015年11月24日 (二) 15:08的版本
OpevnVZ 一些自用初始化脚本
服务端
安装 dnsmasq
yum install dnsmasq sed -i "s/#resolv-file.*$/resolv-file=\/etc\/resolv.masqdns cp /etc/resolv.conf /etc/resolv.masqdns echo "nameserver 127.0.0.1" > /etc/resolv.conf chkconfig dnsmasq on service dnsmasq start
安装 openvz
wget -P /etc/yum.repos.d/ http://ftp.openvz.org/openvz.repo rpm --import http://ftp.openvz.org/RPM-GPG-Key-OpenVZ yum install vzkernel
客户机
安装java基本环境
sed -i "s/archive.ubuntu.com/mirrors.163.com/" /etc/apt/sources.list apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 40976EAF437D05B5 apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 3B4FE6ACC0B21F32 apt-get update apt-get dist-upgrade locale-gen --lang zh_CN.UTF-8 dpkg-reconfigure locales update-locale lang=zh_CN.UTF-8 rm /etc/localtime ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime echo "Asia/Shanghai" >/etc/timezone apt-get install openjdk-7-jdk apt-get install sudo screen adduser ubuntu adduser ubuntu sudo
安装数据库 postgresql
apt-get install postgresql postgresql-contrib sed -i "s/#\(include_if_exists.*\)/\1/" /etc/postgresql/9.3/main/postgresql.conf echo "listen_addresses = '*'" >> /etc/postgresql/9.3/main/exists.conf echo "host all all 0.0.0.0/0 md5" >> /etc/postgresql/9.3/main/pg_hba.conf /etc/init.d/postgresql restart
设置数据库密码
sudo -u postgres psql postgres postgres=# \password postgres postgres=# \quit
安装 uuid 扩展
sudo -u postgres psql postgres postgres=# CREATE EXTENSION "uuid-ossp"; CREATE EXTENSION postgres=# select uuid_generate_v4(); uuid_generate_v4 -------------------------------------- a4829383-e6f9-419f-a567-196ccf72b190 (1 row) postgres=# select uuid_generate_v1(); uuid_generate_v1 -------------------------------------- ffc5a0fa-156b-11e5-a568-6f5620948752 (1 row)
下载wildfly
su ubuntu cd wget http://download.jboss.org/wildfly/8.2.0.Final/wildfly-8.2.0.Final.tar.gz tar xzvf wildfly-8.2.0.Final.tar.gz mv wildfly-8.2.0.Final wildfly rm wildfly-8.2.0.Final.tar.gz echo 'JAVA_OPTS="$JAVA_OPTS -Djboss.bind.address=0.0.0.0"' >> /home/ubuntu/wildfly/bin/standalone.conf echo 'JAVA_OPTS="$JAVA_OPTS -Djboss.bind.address.management=0.0.0.0"' >> /home/ubuntu/wildfly/bin/standalone.conf echo 'ubuntu=35291eedea6d270cb71fe7dfd36d0c89' >> /home/ubuntu/wildfly/standalone/configuration/mgmt-users.properties echo 'ubuntu=' >> /home/ubuntu/wildfly/standalone/configuration/mgmt-groups.properties cd /home/ubuntu/wildfly/standalone/deployments wget https://jdbc.postgresql.org/download/postgresql-9.4-1200.jdbc41.jar
建立数据库
sudo -u postgres createdb core -E UTF8 -T template0
配置wildfly数据源
cd /home/ubuntu/wildfly/bin ./jboss-cli.sh --connect
创建数据源的命令为:
data-source add --name=core --jndi-name=java:/core --driver-name=postgresql-9.4-1200.jdbc41.jar --connection-url=java:postgresql:core --user-name=postgres --password=postgres --transaction-isolation==TRANSACTION_READ_COMMITTED --min-pool-size=10 --max-pool-size=250
例如:
[standalone@localhost:9990 /] data-source add --name=core --jndi-name=java:/core --driver-name=postgresql-9.4-1200.jdbc41.jar --connection-url=java:postgresql:core --user-name=postgres --password=postgres --transaction-isolation==TRANSACTION_READ_COMMITTED --min-pool-size=10 --max-pool-size=250 [standalone@localhost:9990 /] exit