Setup MyLVS

From MyLVS
Jump to navigation Jump to search

Setup mySQL

At the very step we need to setup the database with all the required tables, please use the import script mylvs.sql to do so.
You'll find the script within the download archive in /scripts or on the reference vm in /var/www/mylvs/scripts

mysql -u root -p < lvs.sql

Create the Database and the Users

Create the database, login into myslq:

# mysql -u root -p 

On the SQL prompt type:

mysql> create database mylvs;

Create the default mylvs user using the password = demo:

mysql> GRANT ALL PRIVILEGES ON mylvs.* TO mylvsuser@localhost IDENTIFIED BY 'demo';

Add the demo user into myLVS, table tblUsers:

mysql> insert into tblUsers (userID,name,operations,logview,showcon,searchcon,reset,reboot,search,whois,nslookup,scan,servermanager) values ('1','demo','1','1','1','1','1','1','1','1','1','1','1');

Setup Apache

Get and copy the Apache template to:

/etc/apache2/sites-enabled/mylvs.conf

Verify the configuration and enable it with a2ensite:

a2ensite mylvs.conf

Add an demo account to apache, this will be the login through the browser:

root@mylvs01:/# htpasswd -c /var/www/mylvs/wwwroot/.htpasswd.users demo

Login to myLVS

Depending on your client OS you may add a hostheader to your host file, to do this type

  • Linux
# vi /etc/hosts
  • Windows (Administrator command shell)
notepad c:\Windows\System32\drivers\etc\hosts

Add:

192.168.x.y	mylvs.foo
  • Note: The Windows DNS Cache requires a reload:
ipconfig/flushdns

Navigate your prefered browdsr to mylvs.foo, login using demo, demo.
You should see an empty configuration scren.


Automatic load of myLVS setting

To automatic load the myLVS configuration it is requires to setup sysmctl which comes new with Debian 8.
This configuration will start on boot only using the type oneshot
Create File: /etc/systemd/system/mylvs-init.service

Add:

[Unit]
Description=myLVS Startup Script
After=network.target auditd.service mysql.service
[Service]
Type=oneshot
ExecStart=/usr/bin/perl /var/www/mylvs/mylvsinit.pl -a
[Install]
WantedBy=multi-user.target


  • First status
root@mylvs01:/systemctl status mylvs-init.service
mylvs-init.service - myLVS Startup Script
 Loaded: loaded (/etc/systemd/system/mylvs-init.service; disabled)
 Active: inactive (dead)
  • Enable: systemctl enable mylvs-init.service

Output:

Created symlink from /etc/systemd/system/multi-user.target.wants/mylvs-init.service to /etc/systemd/system/mylvs-init.service.
  • Reload (optional): systemctl daemon-reload
  • Reboot to test
  • Live Status
root@mylvs01:/home/demo# systemctl status mylvs-init.service
mylvs-init.service - myLVS Startup Script
  Loaded: loaded (/etc/systemd/system/mylvs-init.service; enabled)
  Active: inactive (dead) since Mon 2015-08-17 14:53:48 EDT; 1min 38s ago
 Process: 933 ExecStart=/usr/bin/perl /var/www/mylvs/mylvsinit.pl -a (code=exited, status=0/SUCCESS)
Main PID: 933 (code=exited, status=0/SUCCESS)