How to Install SSH in Ubuntu

Lab Steps

  1. First install SSHD (secure shell daemon) and client. Type in the following commands in a terminal session:
    sudo apt-get install openssh-server openssh-client
  2. Test your installation by connecting to your own server. Type in the following comand:
    ssh localhost
    or
    ssh your-username@your-server-ip-address
  3. Basically you connect to your SSH server by knowing three things: 1) your domain name or ip address, 2) your username, and 3) your password.
  4. If you are using another remote Linux terminal to connect to your SSH server you will type the following terminal commands:
    ssh your-username your-server-domain.name-or-ipaddress
    example: ssh dan somedomain.com
    or
    ssh your-username@your-server-domain.name-or-ipaddress
    example: ssh dan@somedomain.com 
  5. If you are using a program like PuTTY in Windows to connect to your SSH server you will need to fill in your domain name or ip address and click “Open”, after which you will be prompted for your username and password.
  6. The terminal commands to start, stop and restart your sshd server are:
    sudo /etc/init.d/ssh start
    sudo /etc/init.d/ssh stop
    sudo /etc/init.d/ssh restart

Troubleshooting

If you are l having problems connecting to your SSH server from another remote computer it may be a firewall issue. By default SSH makes connections on port 22, so you will have to make sure port 22 is open on your Linux computer, and if you are connecting from another network that port forwarding is enabled on your local router/firewall device on port 22 as well.


How to Install Wine in Ubuntu

Overview

Wine is open-source software that allows you to run Windows programs in Linux. Wine can run on Linux, OSX and Unix computers running the x86 architecture. Although you can find Linux alternatives for most types of software, Wine is great when there is no alternative and it is also nice to be able to run a Windows game every now and then on your Linux computer too. Notepad++ is a great first program to download, install, and run with Wine.

Wine Instructions

1.  Open a terminal (Dash Home > Search for “terminal”), or (Applications > Accessories > Terminal) and key in the following commands:
2.   sudo add-apt-repository ppa:ubuntu-wine/ppa
3.   sudo apt-get update
4.   sudo apt-get install wine1.3
5When you get to the End User License Agreement hit the tab key to highlight the <Ok> button and hit enter.
6.  Download the Notepad++ installer by going to their website and clicking the download link: http://notepad-plus-plus.org/.
7.  If you downloaded the installer with Firefox is will be located in your downloads folder.
8.  To launch the installer navigate to your Downloads folder:
    sudo cd ~/Downloads
sudo ls
wine <name-of-the-installer>

You can also double click on the executable installer and Wine will install it to the virtual c: drive and then run it!
9. After the installation you will find Wine in your programs under Applications > Wine or just search for Wine.

Links for more information:

The Wine website: http://www.winehq.org/
Installation instructions: http://www.winehq.org/download/deb
FAQ: http://wiki.winehq.org/FAQ
Programs that work well with Wine: http://appdb.winehq.org/
Visit the Wine Wiki:  http://wiki.winehq.org/FAQ

 

Video Tutorials

How to install and run Wine in Ubuntu Linux

 How to install and uninstall a Windows program in Linux with Wine

Install Apache, PHP, MySQL, & phpMyAdmin in Ubuntu

Overview

Apache – Apache web server is the most widely utilized web server in the world and most of the world’s websites are served on Apache web servers. Apache development is run by the Apache Software Foundation, which is a community of software developers. Apache is released with an open-source software license. There are releases of Apache that can run on most operating systems including Unix, Linux, Windows and Apple to name a few. Most often Apache is run on Linux web servers. The danscourses.com website is hosted on an Apache webserver, using shared webhosting. Shared webhosting utilizes Apache’s ability to host multiple websites on one web server, called virtual hosts.

PHP – is a programming or scripting language that is typically installed on a web server, but it can also be installed on an end user computer system. It is one of the most popular scripting languages to install on web servers in order to create dynamic web content. It is called a server-side scripting language in that the PHP code is interpreted by the web server, and html content is generated, and sent to the user’s web browser. The PHP code is interpreted and executed by the PHP engine or interpreter which is often installed as a module in the web server. PHP is very useful for retrieving and sending data to and from relational databases like MySQL. PHP is freely distributed software and has available releases for most major operating systems. PHP is a competitor with other server-side programming languages, like Microsoft’s Active Server Pages (ASP) and Sun’s JavaServer Pages (JSP).

{loadposition adposition6}MySQL – MySQL is currently the most popular relational database management system (RDBMS) in the world. MySQL functions as a database server that allows users to connect to its stored databases. MySQL is open-source software released under the GNU public license (GPL). MySQL is used in conjunction with many popular web applications and content management systems like Joomla (this website), WordPress, and Drupal to name only a few.

PhpMyAdmin – is a graphical, browser-based management interface, for working with MySQL. PhpMyAdmin is an open-source project written in PHP. PhpMyAdmin can make managing MySQL databases more intuitive, and easier to learn.

 

Installation Steps

    1. Open a terminal (the commands in this lab should work with Ubuntu and Linux Mint)
    2. Type in the following command to update your software package repositories. You will be required to type in your password:
      sudo apt-get update

    3.  You will need a text editor later in this lab. Upgrade the vi command line text editor by entering the following command and pressing enter, or Y and enter, when prompted to proceed with the install:
      sudo apt-get install vim

    4. Type in the following command to install Apache web server, press enter when prompted:
      sudo apt-get install apache2

    5. To check to see if Apache is running open Firefox and type in the following web address:
      http://localhost   or,    http://127.0.0.1
      You should see the message, “It Works!” This is the Apache homepage, the index.html file and it means the server has installed correctly and is currently running.

    6. If you didn’t see “It Works!” try starting the server. The commands to start, stop, restart, and test status in Apache are:
      sudo systemctl start apache2
      sudo systemctl stop apache2
      sudo systemctl restart apache2
      sudo systemctl status apache2

      The deprecated older method using init.d is:
      sudo /etc/init.d/apache2 start
      sudo /etc/init.d/apache2 stop
      sudo /etc/init.d/apache2 restart
      sudo /etc/init.d/apache2 status

    7. Go to the Apache web directory (i.e. where you put your webpages and websites) and look for the index.html file. Type in the following commands:
      cd /var/www/
      ls
          In Mint 17 and 18 the directory is:
      cd /var/www/html
      ls

      You should see the index.html file listed in the directory
    8. Open the index.html file, edit it, and save it. Type in the following command to open index.html in the vi text editor:
      sudo vi index.html
      To edit the file press i to enter insert mode. Now you can edit and personalize it:

      <html><body><h1>Your Name’s Website</h1>
      <p>Hello everyone, this is my homepage!</p>
      <p>I will update this page soon.</p>
      </body></html>

      To exit and save changes, press the esc key, then type :wq and press enter to save and quit.
    9. Refresh the web page in Firefox to see your changes. You now have an Apache web server running on your local computer and you know how to add/edit webpage content. Time to learn HTML and CSS… 🙂
    10. To install PHP5 and the Apache library/module for PHP type in the following command and press enter when prompted to accept:
      sudo apt-get install php libapache2-mod-php7.0

 

    1. Once PHP has been installed restart Apache. Type in the following command:
      sudo systemctl restart apache2
      or,
      sudo /etc/init.d/apache2 restart

 

    1. Now we need to test PHP by writing a PHP file and calling the phpinfo function. Type in the following command to create a php text file and open it in gedit:
      sudo touch /var/www/test.php
      sudo vi /var/www/test.php

      In Mint 17, 18 the command and directory is:
      sudo touch /var/www/html/test.php
             sudo vi /var/www/html/test.php

    2. To edit the test.php file in vi press i to enter insert mode, and type in the following line:

      <?php phpinfo(); ?>

      To exit and save changes, press the esc key, then type :wq and press enter to save and quit.

    3. Open your Firefox browser and put in the following web address:
      http://localhost/test.php

 

    1. If PHP is working you should see a long page of information about the installed version of PHP and its configuration parameters.

 

    1. Now to install MySQL server. Type in the following command and press enter when prompted to accept:
      sudo apt-get install mysql-server

      During the installation you will be prompted to enter a password for MySQL root user, do so and hit the Tab key to highlight the <Ok> button and press enter.

      If you leave the password blank you can always enter it later by typing the following command:
      mysql -u root
      mysql> SET PASSWORD FOR ‘root’@’localhost’ = PASSWORD(‘yourpassword’);

 

  1. Once you have MySQL installed you will want to install the phpMyAdmin tool as an easy interface to working with MySQL. Type in the following command:
    sudo apt-get install php7.0-mysql phpmyadmin
    During the installation you may need to choose Apache2 to be the database associated with MySQL and phpmyadmin. Make sure Apache2 is selected and tab, click enter
    During the installation you may need to choose ‘yes’ to have ‘dbconfig-common’ handle the database configuration for you. Choose yes and hit enter. You will be prompted twice for your MySQL root user password.
  2. Create a symbolic link from phpMyAdmin to the Apache www directory. Type in the following command:
    sudo ln -s /usr/share/phpmyadmin /var/www/phpmyadmin

    In Mint 17 and 18 the command and directory is:
    sudo ln -s /usr/share/phpmyadmin /var/www/html/phpmyadmin

  3. Now put the following web address in Firefox:
    http://localhost/phpmyadmin
    You should see the phpMyAdmin login page, but if you get an error page instead, then restart the Apache webserver, and refresh the webpage in the web browser:
    sudo /etc/init.d/apache2 restart 
  4. Refresh http://localhost/phpmyadmin in your browser to get to the phpMyAdmin login page. Type in the user field as ‘root’ and the password you set during the installation process and log in. Cheers!

Video Tutorial

In this video I download, install, and run Apache web server in Ubuntu

In this video I install PHP to an Apache web server in Ubuntu

In this video I install MySQL and PhpMyAdmin to an Apache web server in Ubuntu

Troubleshooting

If you choose advanced configuration option you may need to configure php to work with MySQL by editing the php.ini file:

sudo gedit /etc/php5/apache2/php.ini
Uncomment the following line by removing the semicolon:
;extension=mysql.so (to)
extension=mysql.so
Also people report mysql.so missing the “y” like this:
;extension=msql.so (to)
extension=mysql.so

sudo /etc/init.d/apache2 restart

Options

If you choose to have your MySQL server on a network you may need to edit the bind-address. To do that type the following commands to edit the my.cnf file:
      sudo gedit /etc/mysql/my.cnf
Change the following line to your ip address:
      bind-address = 127.0.0.1

 

 

Welcome to Linux Fundamentals

Introducing Linux

This class is going to introduce you to working with the Linux operating system. If you are a networking student then it is to your advantage to know how to use Linux. Linux is an operating system with both enterprise commercial, and freely downloadable and installable distributions. The Linux operating system uses open source software licensed under the GNU Free Software Foundation. By using Linux you take advantage of a community of programmers dedicated to the distribution and availability of freely accessible and distributable software. Linux is the preferred operating system for running servers, including Apache web servers, BIND DNS servers, and running one of many network monitoring applications. Linux is an excellent alternative to Windows due to its stability and the worldwide community of developers freely contributing software development. In this class we will be working with Debian based systems like Ubuntu and Mint, Fedora, and the CentOS Linux distribution. Students may choose to work with other distributions as well.

Class Materials

The content of this class maps to the Comp TIA Linux+ certification exam. The curriculum used in the class is TestOut.com’s Linux+ Powered by LPI curriculum. You can purchase the software directly from the TestOut.com website. First, go to http://www.testout.com and create a user account, next go to http://www.testout.com/home/student-resources/student-purchasing , enter the promotion code (which I will provide you with), then click on “Linux+ Powered by LPI” LX0-101 and LX0-102 under the CompTIA Products area. This webpage describes the curriculum: http://www.testout.com/home/it-certification-training/labsim-certification-training/Linux-. With the promotional code, the student discount priceis $89. You can get the promotional code for the discount pricing from your instructor or if you have a legitimate .edu email account and you are a current student you can contact TestOut.com directly and request the discounted price. When you purchase your curriculum make sure to list your college and the name of your instructor.

Additional reading materials, tutorial videos, and class lab assignments will be given on a weekly basis here at danscourses.com. My video tutorials are organized in a YouTube playlist here: http://www.youtube.com/playlist?list=PL8A83A276F0D85E70 .

Class Schedule and Policies

  • Where can I find the class syllabus?
    The syllabus is located in Blackboard or you can download it here and save it for your records: syllabus
  • How do I turn in assignments?
    All assignments will be turned in using the college Blackboard system or as an email attachment. Contact your instructor for which method will be used.
  • What will I be graded on?
    I grade on a point system. You will be graded on the following items:
    1) LabSim chapter assignments
    2) Weekly Lab Assignments (non-LabSim)
    3) Attendance
    4) Final Exam

    LabSim Chapter Assignments – Every week I will assign a chapter or portion of the LabSim Curriculum for you to accomplish. For you to earn the points you will need to:

    • Watch the videos and demonstrations – I can tell if you have only watched the video for 30 seconds and clicked away. LabSim records the amount of time and how many visits you spend on the different sections. As your instructor I will have access to your user interaction and scorses within the curriculum. LabSim has a button that allows to print a transcript of the videos this is very usefulfor review, studying, and to save for your records!
    • Read the Lesson Documents – LabSim will provide you with documents. Read them and print them out for your records (You only have access to this product for a limited time … one year I believe)
    • Accomplish the Interactive Lab Simulations – You can take and retake the simulations as many times as necessary. It often takes more than one attempt to complete a lab successfully. You will not be graded down for retaking!
    • Pass the Chapter Exams – Some of the chapters will have a multiple choice end of chapter exam for you to take and pass. You can take and retake the chapter exams as many times as necessary. It often takes more than one attempt to pass a chapter exam. You will not be graded down for retaking the exams!As you make your way through the LabSim curriculum your progress is recorded. I will give you credit (points) for passing through the different chapters. If I see that you spent little to no time, or skipped a particular section, I will take away points.

    Weekly Lab Assignments (non-LabSim) – Every week I will give a hands-on lab assignment based on either the TestOut LabSim curriculum, my own experiences and experimentations, or other additional material. To earn full points for a lab, you will need to follow the instructions, complete the lab, and submit documented proof of lab completion. The lab may require you to do additional research, write a short paper, or participate in an online discussion by submitting a post to a comment board or forum.

Week 1 Overview

First, you need to purchase the Linux+ curriculum from LabSim Testout (see class materials above). You will need to create a TestOut user account, put in your promotion code, purchase your activation license, and enter your activation code to unlock the curriculum. Once the curriculum is unlocked you can start the Week 1 LabSim Assignment below.

Second, for the week 1 lab assignment you will need install Linux both in the classroom and on your home computer system. I will give more information about how I would like you to go about this in class. You will also find more information about the lab assignment under Week 1 Lab – Installing Linux (see below).

Week 1 LabSim Assignment (due Sunday)

Complete all of section 0.0 – Introduction

  • 0.1.1 Instructor Introduction
  • 0.1.2 Linux+ Certification Overview
  • 0.1.3 Linux Operating System Introduction

Complete all of section 2.0 – Installation and Localization

  • 2.1 Installation Design
  • 2.2 Linux Installation
  • 2.3 Localization

    The LabSim curriculum will consist of materials to read, videos demonstrations to watch, and interactive simulations to accomplish. At the end of some of the chapter subsections there are multiple choice exams. All of these tasks to be accomplished can be retaken and you will find yourself redoing some of them more than once or even twice. This is not a bad thing. I will be able to chart your progress through TestOut.

Week 1 Lab – Installing Linux (due Sunday)

In order to practice using Linux and work on lab assignments, you will need to have access to Linux both in the classroom and at home. Here are the choices for installing Linux at home, in my suggested order of preference.

  1. Install Linux in a virtual machine on your Windows or Apple computer using VMware or Virtualbox (If you are new to Linux this is the method I recommend)
  2. Install Linux on an old computer.
  3. Install Linux alongside Windows or OSX in a dual boot scenario.
  4. Install Linux on a USB thumb drive or Live CD (need a CD or thumb drive 4 to 8 Gigabytes recommended)

Click here to go to Installing Linux in a Virtual Machine (Mint 14.1)

Click here to go to Install Linux Mint 14.1  (Spring 2013)

Click here to go to Install Ubuntu 11.10 (Spring 2012)

Click here to go to Install Fedora 16 (Spring 2012)

Turning it in:
Depending on your particular instructor, submit a screenshot of your Linux installation by Blackboard or as an email attachment. In the class environment it is preferable to install Linux as a virtual machine using VMware or Virtualbox. Using virtual machines makes it is easy to jump back and forth between different Linux distributions as well as create custom designed installs for specific purposes.