|
2 | 2 |
|
3 | 3 | This repository provides a Vagrantfile for a consistent Linux-based web development environment designed for the use in web development classes at the [Upper Austria University of Applied Sciences (FH Oberösterreich), Hagenberg Campus](https://www.fh-ooe.at/en/hagenberg-campus/). |
4 | 4 |
|
5 | | -The Vagrantfile works with our own [fhooe/fhooe-webdev box](https://app.vagrantup.com/fhooe/boxes/fhooe-webdev), which is based on Ubuntu 21.10 and includes Apache2, PHP 8.1, MariaDB 10.7, as well as additional tools and scripts. |
| 5 | +The Vagrantfile works with our own [fhooe/fhooe-webdev box](https://app.vagrantup.com/fhooe/boxes/fhooe-webdev), which is based on Ubuntu 22.04 and includes Apache2, PHP 8.2, MariaDB 10.11, as well as additional tools and scripts. |
6 | 6 |
|
7 | | -Not familiar with Vagrant or not sure, why to use it? Have a look at the [Introduction](https://www.vagrantup.com/intro/) first. |
| 7 | +Not familiar with Vagrant or not sure why to use it? Have a look at the [Introduction](https://www.vagrantup.com/intro/) first. |
8 | 8 |
|
9 | | -## Installation of software and prerequisites |
| 9 | +## Installation of Software and Prerequisites |
10 | 10 |
|
11 | 11 | To use this environment, you will need [VirtualBox](https://www.virtualbox.org/) and [Vagrant](https://www.vagrantup.com/). For them to work on your machine, make sure the following prerequisites are fulfilled: |
12 | 12 |
|
13 | 13 | * Virtualization is activated in BIOS. |
14 | | -* 10 GB of disk space is available locally. If possible use an SSD for better performance. |
15 | | -* [Windows] At least VirtualBox 6.1.26 under Windows 10 21H1 or Hyper-V deactivated when using an earlier version. |
16 | | -* [Mac OS X] Make sure, VirtualBox has the necessary permissions. Go to "System Settings -> Security -> Allow Virtual Box". |
| 14 | +* 10 GB of disk space is available locally. If possible, use an SSD for better performance. |
| 15 | +* [Windows] At least VirtualBox 6.1.26 under Windows 10 21H1 or Hyper-V deactivated when using an earlier version. Version 7 and the latest version of Windows are recommended. |
| 16 | +* [Mac OS X] Make sure VirtualBox has the necessary permissions. Go to "System Settings -> Security -> Allow Virtual Box". |
17 | 17 |
|
18 | 18 | Then install the required software in the following order: |
19 | 19 |
|
20 | | -1. Download the latest version of VirtualBox from <https://www.virtualbox.org/wiki/Downloads> and install. Alternatively, when running Windows, use [Chocolatey](https://chocolatey.org/): `choco install virtualbox`. |
21 | | -2. Download the latest version of Vagrant from <https://www.vagrantup.com/downloads.html> and install. With Chocolatey on Windows run `choco install vagrant`. |
| 20 | +1. Download the latest version of VirtualBox from <https://www.virtualbox.org/wiki/Downloads> and install it. Alternatively, when running Windows, use [Chocolatey](https://chocolatey.org/): `choco install virtualbox`. |
| 21 | +2. Download the latest version of Vagrant from <https://www.vagrantup.com/downloads.html> and install it. With Chocolatey on Windows, run `choco install vagrant`. |
22 | 22 | 3. Reboot your computer for all changes to take effect. |
23 | 23 |
|
24 | | -## How to use the Vagrantfile |
| 24 | +## How to Use the Vagrantfile |
25 | 25 |
|
26 | 26 | 1. Download or clone the [fhooe-webdev](https://github.com/Digital-Media/fhooe-webdev) repository to a location of your choice on your computer. If you don't want the whole repository, downloading the [Vagrantfile](https://github.com/Digital-Media/fhooe-webdev/blob/master/Vagrantfile) will suffice. |
27 | | -2. Open PowerShell, a command prompt or the terminal. |
| 27 | +2. Open PowerShell, a command prompt, or the terminal. |
28 | 28 | 3. Switch to the directory where you cloned/downloaded the repository or Vagrantfile, e.g. `cd <path-to>/fhooe-webdev`. |
29 | | -4. Run `vagrant up`. This will download the [fhooe/fhooe-webdev box](https://app.vagrantup.com/fhooe/boxes/fhooe-webdev) (a fully configured Ubuntu image) from Vagrant Cloud, provision it and run it without a GUI (headless mode). |
30 | | -5. Once the image has finished downloading and has started sucessfully, you can use `vagrant ssh` to connect to the image's shell via SSH. |
31 | | -6. To stop and shut down the image call `vagrant halt`. |
32 | | -7. To destroy the image (in case you don't need it anymore or want it re-initialized) call `vagrant destroy`. |
| 29 | +4. Run `vagrant up`. This will download the [fhooe/fhooe-webdev box](https://app.vagrantup.com/fhooe/boxes/fhooe-webdev) (a fully configured Ubuntu image) from Vagrant Cloud, provision it, and run it without a GUI (headless mode). |
| 30 | +5. Once the image has finished downloading and has started successfully, you can use `vagrant ssh` to connect to the image's shell via SSH. |
| 31 | +6. To stop and shut down the image, call `vagrant halt`. |
| 32 | +7. To destroy the image (in case you don't need it anymore or want it re-initialized), call `vagrant destroy`. |
33 | 33 |
|
34 | | -## How to use the image for web development |
| 34 | +## How to Use the Image for Web Development |
35 | 35 |
|
36 | | -Once the image has successfully booted you will notice that a folder called `code` inside of your `<path-to>/fhooe-webdev` directory has been created. This directory is mapped to `/var/www/html/code` in the image via Vagrant's shared folder functionality. Since it points to Apache's document root, files are immediately served through the web server. |
| 36 | +Once the image has successfully been booted, you will notice that a folder called `webapp` inside your `<path-to>/fhooe-webdev` directory has been created. This directory is mapped to `/var/www/html/webapp` in the image via Vagrant's shared folder functionality. Since it points to Apache's document root, files are immediately served through the web server. |
37 | 37 |
|
38 | | -Additionally, the Vagrantfile configures the IP address `172.16.7.7` as a private network, so you can access the machine - and therefore its web server - under this address. |
| 38 | +Additionally, the Vagrantfile configures the IP address `172.16.7.7` as a private network so you can access the machine and its web server under this address. |
39 | 39 |
|
40 | | -To develop and deploy your web applications, copy them to the `code` folder on your host machine. They will be instantly available through the Vagrant image's web server at 172.16.7.7. E.g.: |
| 40 | +To develop and deploy your web applications, copy them to the `webapp` folder on your host machine. They will be instantly available through the Vagrant image's web server at 172.16.7.7. E.g.: |
41 | 41 |
|
42 | | -- `code/my_example_project/index.php` -> <https://172.16.7.7/code/my_example_project/index.php> |
| 42 | +- `webapp/my_example_project/index.php` -> <https://172.16.7.7/webapp/my_example_project/index.php> |
43 | 43 |
|
44 | | -There's a file called `phpinfo.php` in the `code` directory that allows you to quickly check the configuration of this image. Also [phpMyAdmin](https://www.phpmyadmin.net/) is already installed and configured. These are available here: |
| 44 | +There's a file called `phpinfo.php` in the `webapp` directory that allows you to check the configuration of this image quickly. Also, [phpMyAdmin](https://www.phpmyadmin.net/) is already installed and configured. These are available here: |
45 | 45 |
|
46 | | -- <https://172.16.7.7/code/phpinfo.php> |
| 46 | +- <https://172.16.7.7/webapp/phpinfo.php> |
47 | 47 | - <https://172.167.7.7/phpmyadmin> |
48 | 48 |
|
49 | | -The default configuration uses HTTPS and mimics a production webserver without displaying any PHP errors. To work without HTTPS (thus avoiding the certificate warning), open your files with HTTP on port 81. E.g.: |
| 49 | +The default configuration uses HTTPS and mimics a production web server without displaying any PHP errors. To work without HTTPS (thus avoiding the certificate warning), open your files with HTTP on port 81. E.g.: |
50 | 50 |
|
51 | 51 | - http://172.16.7.7:81/ for the dashboard or |
52 | | -- http://172.16.7.7:81/code/ for the code directory. |
| 52 | +- http://172.16.7.7:81/webapp/ for the webapp directory. |
53 | 53 |
|
54 | | -Since all the files of your web projects are on your host computer, you can destroy, remove or reset the Vagrant image at any time. Nothing within the `code` directory is affected. |
| 54 | +Since all the files of your web projects are on your host computer, you can destroy, remove or reset the Vagrant image at any time. Nothing within the `webapp` directory is affected. |
55 | 55 |
|
56 | | -## Tips and troubleshooting |
| 56 | +## Tips and Troubleshooting |
57 | 57 |
|
58 | | -- During the initial `vagrant up` a stable internet connection for downloading the box file is required. Once the box has been downloaded you can work offline. |
59 | | -- If the box hangs during booting at the SSH steps, you can disable the automatic SSH login and use a user/password combination instead. See the commented out sections in the Vagrantfile for this. |
| 58 | +- During the initial `vagrant up`, a stable internet connection for downloading the box file is required. Once the box has been downloaded, you can work offline. |
| 59 | +- If the box hangs during booting at the SSH steps, you can disable the automatic SSH login and use a user/password combination instead. See the commented-out sections in the Vagrantfile for this. |
| 60 | +- Another solution for a hanging box at startup is to launch the Oracle VM VirtualBox Manager application. Select the VM that is being booted by Vagrant. This can help get the booting process unstuck. |
60 | 61 | - For more tips and troubleshooting, see the [fhooe-webdev Wiki](https://github.com/Digital-Media/fhooe-webdev/wiki). |
0 commit comments