2017年9月5日火曜日

Vagrantでowncloudがインストールされた仮想マシン(ubuntu16.04)を構築する

ownCloudのパッケージ名称が変わり、このVagrantfileでは動作しないのでVagrantでownCloudとPostgreSQLをインストールした仮想マシン(Ubuntu16.04)を構築するを参照してください

以下のVagrantfileでは、データベースにmysqlを使用するように構成されたowncloudをインストールします。

Vagrantfile

VAGRANTFILE_API_VERSION = "2"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
  config.vm.box = "bento/ubuntu-16.04"
  config.vm.hostname = "ub1604owncloud"
  config.vm.provider :virtualbox do |vbox|
     vbox.name = "ub1604owncloud"
     vbox.cpus = 2
     vbox.memory = 2048
     vbox.customize ["modifyvm", :id, "--nicpromisc2","allow-all"]
  end
  config.vm.network "private_network", ip: "192.168.55.108", :netmask => "255.255.255.0"
  config.vm.network "public_network", ip:"192.168.1.108", :netmask => "255.255.255.0"
  config.vm.provision "shell", inline: <<-SHELL
# update packages
apt-get update
DEBIAN_FRONTEND=noninteractive apt-get -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" upgrade

# install mysql
echo "mysql-server-5.7 mysql-server/root_password password root" | sudo debconf-set-selections
echo "mysql-server-5.7 mysql-server/root_password_again password root" | sudo debconf-set-selections
apt-get -y install mysql-server-5.7

# install owncloud
wget -nv https://download.owncloud.org/download/repositories/stable/Ubuntu_16.04/Release.key -O Release.key
apt-key add - < Release.key
sh -c "echo 'deb http://download.owncloud.org/download/repositories/stable/Ubuntu_16.04/ /' > /etc/apt/sources.list.d/owncloud.list"
apt-get update
apt-get -y install owncloud

cd /var/www/owncloud
sudo -u www-data sh -c "php occ maintenance:install --database mysql --database-name owncloud  --database-user root --database-pass root --admin-user admin --admin-pass admin"
sed -i -e "s/0 => 'localhost'/0 => '192.168.1.108', 1 => '192.168.55.108'/" /var/www/owncloud/config/config.php
sed -i -e "s/\\/\\/localhost/\\/\\/192.168.1.108/" /var/www/owncloud/config/config.php
service apache2 restart

echo 'access http://192.168.55.108/owncloud/'
echo 'user: admin, password: admin'
SHELL
end


my.cnf

[client]
port            = 3306
socket          = /var/lib/mysql/mysql.sock
default-character-set=utf8

[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
bind-address = 0.0.0.0
port            = 3306
key_buffer_size = 256M
max_allowed_packet = 16M
table_open_cache = 16
innodb_buffer_pool_size = 512M
innodb_log_file_size = 32M
sort_buffer_size = 8M
read_buffer_size = 8M
read_rnd_buffer_size = 8M
join_buffer_size = 8M
thread_stack = 4M
character-set-server=utf8
lower_case_table_names = 1
innodb_lock_wait_timeout=120
skip-innodb-doublewrite

[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

0 件のコメント:

コメントを投稿