In host machine (Win8 laptop) first steps are to install
Vagrant is my favourite tool to manage VM-s from commandline and Virtualbox is best VM provider. After installation open new command line window (cmder is my favourite and cmd.exe is ok also) and make new folder for VM installation. I assume that vagrant.exe is in your PATH.
First steps are to run from commandline in Win8.1 machine
- vagrant init ubuntu/trusty64
- vagrant up --provider virtualbox
- vagrant ssh
Install mysql database
- sudo apt-get -y install mysql-server
- sudo vi /etc/mysql/my.cnf and change bind address line to
bind-address = 0.0.0.0 and save file - sudo service mysql restart
- sudo netstat -tap | grep mysql
tcp 0 0 *:mysql *:* LISTEN 11462/mysqld
should appear on screen
For testing is good to have some test user/database/table
- mysql -u root -p
CREATE USER 'test'@'localhost' IDENTIFIED BY 'a';
CREATE USER 'test'@'%' IDENTIFIED BY 'a';
GRANT ALL ON *.* TO 'test'@'localhost';
GRANT ALL ON *.* TO 'test'@'%';
CREATE DATABASE IF NOT EXISTS test CHARACTER SET = 'utf8';
create table `test_data` ( `i` bigint(20) NOT NULL, `d` datetime NOT NULL, `t` timestamp);
create table `test_data_2` ( `seq` bigint(20) NOT NULL, `d` datetime NOT NULL);
- sudo apt-get -y install phpMyAdmin
Answer (server: apache2) and provide passwords
- vagrant halt
- Edit Vagrantfile and add port forwarding
config.vm.network :forwarded_port, guest: 3306, host: 3306
config.vm.network "forwarded_port", guest: 80, host: 8010 - vagrant up
Install postgres server
In guest machine (vagrant ssh from commandline) execute- sudo apt-get -y install postgresql postgresql-contrib
- sudo vi /etc/postgresql/9.3/main/postgresql.conf
listen_addresses = '*' # uncomment this line - sudo vi /etc/postgresql/9.3/main/pg_hba.conf
# IPv4 remote connections:
host all all 0.0.0.0/0 md5
# add previous line to config file and save file - sudo service postgresql restart
- sudo -i -u postgres
- psql
CREATE USER test SUPERUSER ENCRYPTED PASSWORD 'a';
CREATE DATABASE test OWNER = test ENCODING = 'UTF8';
ALTER USER postgres ENCRYPTED PASSWORD 'a';
\c test
CREATE SCHEMA IF NOT EXISTS test AUTHORIZATION test;
create table if not exists test_data (i int, d date, t timestamp);
CREATE TABLE IF NOT EXISTS test_data_2 (seq serial, d date);
- vagrant halt
- Edit Vagrantfile and add port forwarding
config.vm.network "forwarded_port", guest: 5432, host: 5432 - vagrant up
Installed software
Software installed in host computer (Win8.1)- vagrant 1.8.1
- VirtualBox 5.0.12
- mysql 5.5.46
- phpMyAdmin 4.0.10
- postgreSql 9.3.10
Services accesible from Win8.1 (host)
# 5432 - postgres db (localhost:5432:test/a)# 3306 - mysql db {localhost:3306:test/a}
# 8010 - phpMyAdmin (http://localhost:8010/phpmyadmin {root/a})
No comments:
Post a Comment