Skip to content

cphdat2sem2017-Cos/week01-OS-Linux

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Alt text #week 1 Linux, Webserver og MySQL in the cloud

##Day 1: Github and Linux on Digital Ocean ###Github First you will get an introduction to how we are usinge github as a learning management system.

  • Clone a repository
  • Create a repository on github
  • Clone your repository locally
  • Add, Commit, Push

##Linux We will look at how to set up a linux server on digitalocean, how to manage users on the machine, and how to navigate the server from the command prompt. When settin up the server for the first time we will use this [tutorial](study/Getting Started with Digital Ocean.pdf)
###The tutorial contains these commands:

ssh root@SERVER_IP_ADDRESS  
adduser <user>  
usermod -aG sudo <user>  
su <user>  
cd ~/  
mkdir ~/.ssh  
chmod 700 ~/.ssh  
nano ~/.ssh/authorized_keys  

Insert your ssh public key here.

Check this file: sudo nano /etc/ssh/sshd_config to see if PasswordAuthentication no is there

chmod 600 ~/.ssh/authorized_keys  
exit  
sudo systemctl reload sshd  

Now check if you can log in with <user> from a terminal Install java:

sudo apt-get install default-jdk
java -version

Readings:

##Day 2: SSH & bash scripting Using passwords to secure a server is considered insecure. Instead one use ssh-keys. Also, we will take a look at bash-scripting to automate things on linux. In particular we will automate setting up a linux server with users for your group.

Readings and videos:

##Day 3: MySQL in the cloud We will setup MySQL on the ubuntu server, set up users on MySQL with different rights, and work with SQL from the sql prompt. Also, we will connect to the server from MySQL Workbench and from our java program:

The commands needed for this are

sudo apt-get update
sudo apt-get install mysql-server
sudo mysql_secure_installation
mysql -u root -p
CREATE DATABASE test;

Then change this file:
/etc/mysql/mysql.conf.d/mysqld.cnf by commenting out the bind-address line like this: #bind-address = localhost

mysql -u root –p 
CREATE USER 'testuser'@'localhost' IDENTIFIED BY 'password123'; 
CREATE USER 'testuser'@'%' IDENTIFIED BY 'password123'; 
GRANT ALL ON test.* TO 'testuser'@'localhost'; 
GRANT ALL ON test.* TO 'testuser'@'%';
exit
service mysql restart

Readings:

##Day 4 - Tomcat exercise We will setup Tomcat server on the ubuntu server. We will then deploy a small web application using both tomcat and mysql. We will use the following commands:

apt-get install tomcat8 tomcat8-admin
apt-get install haveged 
nano /etc/tomcat8/tomcat-users.xml

Insert:

<role rolename="manager-gui"/>
<user name="admin" password="XXX" roles="manager-gui, manager-script"/>` 

and save. Take care not to add the two lines inside the comments of the file. In XML the comments start with <!-- and ends with -->.

service tomcat8 restart
sudo nano /etc/tomcat8/server.xml

Replace Connector port="8080" with Connector port="80" in line 71

sudo nano /etc/default/tomcat8

Change #AUTHBIND=no to AUTHBIND=yes (remember to remove the #-sign)

service tomcat8 restart
  • Now open a browser from your laptop and go to: <your ubuntu ip>/manager
  • Deploy a web application from here

##Day 5 - Studypoint exercise

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages