diff --git a/af-ZA/images/Python-Webserver-with-Wordpress-TILE-01.png b/af-ZA/images/Python-Webserver-with-Wordpress-TILE-01.png new file mode 100644 index 0000000..f632634 Binary files /dev/null and b/af-ZA/images/Python-Webserver-with-Wordpress-TILE-01.png differ diff --git a/af-ZA/images/Python-Webserver-with-Wordpress.png b/af-ZA/images/Python-Webserver-with-Wordpress.png new file mode 100644 index 0000000..07b0191 Binary files /dev/null and b/af-ZA/images/Python-Webserver-with-Wordpress.png differ diff --git a/af-ZA/images/apache-hello-world.png b/af-ZA/images/apache-hello-world.png new file mode 100644 index 0000000..69fb339 Binary files /dev/null and b/af-ZA/images/apache-hello-world.png differ diff --git a/af-ZA/images/apache-it-works.png b/af-ZA/images/apache-it-works.png new file mode 100644 index 0000000..fb71d9f Binary files /dev/null and b/af-ZA/images/apache-it-works.png differ diff --git a/af-ZA/images/banner.png b/af-ZA/images/banner.png new file mode 100644 index 0000000..88a7bfb Binary files /dev/null and b/af-ZA/images/banner.png differ diff --git a/af-ZA/images/create-database.png b/af-ZA/images/create-database.png new file mode 100644 index 0000000..34c91f2 Binary files /dev/null and b/af-ZA/images/create-database.png differ diff --git a/af-ZA/images/hostname.png b/af-ZA/images/hostname.png new file mode 100644 index 0000000..bb50249 Binary files /dev/null and b/af-ZA/images/hostname.png differ diff --git a/af-ZA/images/hostname_annotated.png b/af-ZA/images/hostname_annotated.png new file mode 100644 index 0000000..27b2f08 Binary files /dev/null and b/af-ZA/images/hostname_annotated.png differ diff --git a/af-ZA/images/install_apache.png b/af-ZA/images/install_apache.png new file mode 100644 index 0000000..8b5dab8 Binary files /dev/null and b/af-ZA/images/install_apache.png differ diff --git a/af-ZA/images/wordpress-database-setup.png b/af-ZA/images/wordpress-database-setup.png new file mode 100644 index 0000000..a1b2a91 Binary files /dev/null and b/af-ZA/images/wordpress-database-setup.png differ diff --git a/af-ZA/images/wordpress-information_needed.png b/af-ZA/images/wordpress-information_needed.png new file mode 100644 index 0000000..8119d0a Binary files /dev/null and b/af-ZA/images/wordpress-information_needed.png differ diff --git a/af-ZA/images/wordpress-run-installation.png b/af-ZA/images/wordpress-run-installation.png new file mode 100644 index 0000000..b368d00 Binary files /dev/null and b/af-ZA/images/wordpress-run-installation.png differ diff --git a/af-ZA/images/wordpress-welcome.png b/af-ZA/images/wordpress-welcome.png new file mode 100644 index 0000000..9394739 Binary files /dev/null and b/af-ZA/images/wordpress-welcome.png differ diff --git a/af-ZA/images/wordpress_language.png b/af-ZA/images/wordpress_language.png new file mode 100644 index 0000000..4d44ba3 Binary files /dev/null and b/af-ZA/images/wordpress_language.png differ diff --git a/af-ZA/images/wp-info.png b/af-ZA/images/wp-info.png new file mode 100644 index 0000000..032e62e Binary files /dev/null and b/af-ZA/images/wp-info.png differ diff --git a/af-ZA/meta.yml b/af-ZA/meta.yml new file mode 100644 index 0000000..85dfdae --- /dev/null +++ b/af-ZA/meta.yml @@ -0,0 +1,42 @@ +--- +title: Build a LAMP Web Server with WordPress +hero_image: images/banner.png +description: Set up a local server for a website on your Raspberry Pi +original_url: https://raspberrypi.org/learning/lamp-web-server-with-wordpress +theme: turquoise +duration: 2 +listed: true +ingredient: false +copyedit: false +curriculum: 3, design-0, programming-3, phys-comp-0, manufacture-0, community-0 +interests: '' +technologies: raspberry-pi, html-css-javascript +site_areas: projekte +hardware: raspberry-pi +software: html-css-javascript +version: 4 +last_tested: 2017-01-01 +steps: + - + title: Inleiding + - + title: Set up an Apache web server + completion: + - engaged + - + title: Install PHP + - + title: Install MariaDB + - + title: Download WordPress + - + title: Set up your WordPress database + completion: + - internal + - + title: WordPress configuration + completion: + - external + - + title: Challenge + challenge: true diff --git a/af-ZA/step_1.md b/af-ZA/step_1.md new file mode 100644 index 0000000..af2a716 --- /dev/null +++ b/af-ZA/step_1.md @@ -0,0 +1,12 @@ +## Wat gaan jy maak +Learn to set up a LAMP (**L**inux, **A**pache, **M**ySQL, **P**HP) stack on your Raspberry Pi and configure it to work as a web server. + + - Install software on your Raspberry Pi + - Install and configure Apache, PHP, and MySQL to create a LAMP web server + - Download WordPress and run it as a local website on your Raspberry Pi + - Configure WordPress and make your website accessible to other devices on your local network + + +### You will need +- A Raspberry Pi computer connected to the internet +- [An up to date install of the Raspberry Pi OS](https://www.raspberrypi.org/downloads/) diff --git a/af-ZA/step_2.md b/af-ZA/step_2.md new file mode 100644 index 0000000..1cb6c47 --- /dev/null +++ b/af-ZA/step_2.md @@ -0,0 +1,110 @@ +## Set up an Apache web server + +Apache is a popular web server application you can install on the Raspberry Pi to allow it to serve web pages. + +On its own, Apache can serve HTML files over HTTP. With additional modules it can serve dynamic web pages using scripting languages such as PHP. + +### Install Apache + +--- task --- + +Open a terminal window by selecting **Accessories** > **Terminal** from the menu. + +--- /task --- + +--- task --- + +Type the following command into the terminal and press Enter to install `apache2` + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo apt install apache2 -y + +--- /code --- + +**Tip:** If you see an error, make sure you are using the latest version of Raspberry Pi OS. + +--- /task --- + + +### Test the web server + +By default, Apache puts a test HTML file in the web folder that you will be able to view from your Pi or another computer on your network. + +--- task --- + +Open Chromium by selecting **Internet** > **Chromium Web Browser** from the menu. + +--- /task --- + +--- task --- + +Type `localhost` in the address bar. + +--- /task --- + +You should see this in your browser window: + +![Apache it works](images/apache-it-works.png) + +This means you have Apache working! + +### Changing the default web page + +This default web page is just a HTML file on the file system. It is located at `/var/www/html/index.html`. + +--- task --- + +Type the following command in the terminal to change to the directory containing the HTML file: + +--- code --- +--- +language: bash +line_numbers: false +--- +cd /var/www/html + +--- /code --- + +--- /task --- + +--- task --- + +Open the `index.html` file using Thonny + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo thonny index.html + +--- /code --- + +--- /task --- + +--- task --- + +Delete the contents of the file, then type a short message and save your changes. + +--- /task --- + +--- task --- + +Go back to Chromium and refresh the browser. You will see your message appear on the web page. + +--- /task --- + +--- collapse --- +--- +title: Access the page from another device on the network +--- + +You can open your web page from any other computer on your network, using the IP address of your Raspberry Pi, e.g. `http://192.168.1.10`. + +To find out your Raspberry Pi's IP address, type `hostname -I` into the terminal window. + +--- /collapse --- diff --git a/af-ZA/step_3.md b/af-ZA/step_3.md new file mode 100644 index 0000000..4bb6e7f --- /dev/null +++ b/af-ZA/step_3.md @@ -0,0 +1,91 @@ +## Install PHP + +PHP is a **preprocessor**: it's code that runs when the server receives a request for a web page via a web browser. It works out what needs to be shown on the page, and then sends that page to the browser. + +--- task --- + +Type the following command in the terminal to install PHP: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo apt install php -y + +--- /code --- + +--- /task --- + +### Test PHP + +--- task --- + +Type this command to delete the `index.html` file from earlier: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo rm index.html + +--- /code --- + +--- /task --- + +--- task --- + +Create a new file called `index.php`: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo thonny index.php + +--- /code --- + +--- /task --- + +--- task --- + +In the Thonny code editor, type this PHP code into the file and save it. + +--- code --- +--- +language: php +line_numbers: false +--- + + +--- /code --- + +--- /task --- + +--- task --- + +Refresh your browser. You should see "hello world". This page is not dynamic, but it is still served by PHP. + +![hello world](images/apache-hello-world.png) + +--- /task --- + + +--- collapse --- +--- +title: I can only see PHP code +--- +If you see the raw PHP above instead of "hello world", use this command to reload and restart Apache: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo service apache2 restart + +--- /code --- + +--- /collapse --- diff --git a/af-ZA/step_4.md b/af-ZA/step_4.md new file mode 100644 index 0000000..cc6eae1 --- /dev/null +++ b/af-ZA/step_4.md @@ -0,0 +1,75 @@ +## Install MariaDB + +MariaDB is a popular database engine. Like PHP, it's widely used on web servers, which is why projects like WordPress use it, and why those projects are so popular. + + +--- task --- + +Type this command to install the MariaDB Server and PHP-MySQL packages: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo apt install mariadb-server php-mysql -y + +--- /code --- + +--- /task --- + +--- task --- + +Now restart Apache: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo service apache2 restart + +--- /code --- + +--- /task --- + +### Set up + +--- task --- + +Run the MySQL secure installation command in the terminal window. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo mysql_secure_installation + +--- /code --- + +--- /task --- + +--- task --- + +Go through the setup wizard using the following answers: + ++ `Enter current password for root (enter for none):` — press **Enter**. + ++ `Switch to unix_socket authentication [Y/n]` - Type in **N** and press **Enter** + ++ `Change the root password?` - Type in **Y** and press **Enter** + ++ `New password:` - Type in a password and press **Enter**, then repeat a second time. **Important:** remember this root password, as you will need it later to set up WordPress. + ++ `Remove anonymous users` - Type in **Y** + ++ `Disallow root login remotely` - Type in **Y** + ++ `Remove test database and access to it` - Type in **Y** + ++ `Reload privilege tables now` - Type in **Y** + +--- /task --- + +When complete, you will see the message `All done!` and `Thanks for using MariaDB!`. diff --git a/af-ZA/step_5.md b/af-ZA/step_5.md new file mode 100644 index 0000000..d34db90 --- /dev/null +++ b/af-ZA/step_5.md @@ -0,0 +1,109 @@ +## Download WordPress + +WordPress is a popular tool used to quickly create a website or blog with an easy to use editor for creating new content. + + +--- task --- + +In your terminal, make sure you are still in the directory `/var/www/html/` + +--- code --- +--- +language: bash +line_numbers: false +--- +cd /var/www/html/ + +--- /code --- + +--- /task --- + +--- task --- + +Delete all the files in the folder. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo rm * + +--- /code --- + +--- /task --- + +--- task --- + +Type this command to download WordPress + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo wget http://wordpress.org/latest.tar.gz + +--- /code --- + +--- /task --- + +--- task --- + +Extract the WordPress software: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo tar xzf latest.tar.gz + +--- /code --- + +--- /task --- + +--- task --- + +Move the contents of the extracted `wordpress` directory to the current directory. **Tip:** Make sure you type the whole command including the dot. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo mv wordpress/* . + +--- /code --- + +--- /task --- + +--- task --- + +Tidy up by removing the download, and the now empty `wordpress` directory. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo rm -rf wordpress latest.tar.gz + +--- /code --- + +--- /task --- + +---task --- + +Change the ownership of all these files to the Apache user: **Tip:** Make sure you type the whole command including the dot. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo chown -R www-data: . + +--- /code --- + +--- /task --- diff --git a/af-ZA/step_6.md b/af-ZA/step_6.md new file mode 100644 index 0000000..eefa5ec --- /dev/null +++ b/af-ZA/step_6.md @@ -0,0 +1,95 @@ +## Set up your WordPress Database + +--- task --- + +Run `mysql` in the terminal window: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo mysql -uroot -p + +--- /code --- + +--- /task --- + +--- task --- + +Enter the root password you created when you set up the database. + +You will see the message `Welcome to the MariaDB monitor` and then the `MariaDB [(none)]>` prompt. + +--- /task --- + +--- task --- + +At the `MariaDB [(none)]>` prompt, type: **Tip:** Don't forget to type the semicolon at the end. + +--- code --- +--- +language: sql +line_numbers: false +--- +create database wordpress; + +--- /code --- + + + +--- /task --- + +If this has been successful, you should see `Query OK, 1 row affected (0.00 sec)`. + +--- task --- + +At the MariaDB prompt, grant database privileges to the root user. Change `YOURPASSWORD` to the password you created before. + +--- code --- +--- +language: sql +line_numbers: false +--- + +GRANT ALL PRIVILEGES ON wordpress.* TO 'root'@'localhost' IDENTIFIED BY 'YOURPASSWORD'; + +--- /code --- + +--- /task --- + +--- task --- + +For the changes to take effect, you will need to flush the database privileges: + +--- code --- +--- +language: sql +line_numbers: false +--- +FLUSH PRIVILEGES; + +--- /code --- + +--- /task --- + +--- task --- + +Exit the MariaDB prompt with Ctrl + D. + +--- /task --- + +--- task --- + +Restart your Raspberry Pi by typing this command in the terminal: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo reboot + +--- /code --- + +--- /task --- diff --git a/af-ZA/step_7.md b/af-ZA/step_7.md new file mode 100644 index 0000000..be18128 --- /dev/null +++ b/af-ZA/step_7.md @@ -0,0 +1,155 @@ +## WordPress configuration + +--- task --- + +Once your Raspberry Pi has rebooted, open Chromium and type `localhost` into the address bar. + +You should see a WordPress page asking to pick your language. + +![WordPress select language](images/wordpress_language.png) + +--- /task --- + +--- task --- + +Select your language and click **Continue**. + +--- /task --- + +You will be presented with the WordPress welcome screen. + +![WordPress welcome screen](images/wordpress-welcome.png) + +--- task --- + +Click the **Let's go!** button. + +--- /task --- + +--- task --- + +Now fill out the basic site information as follows: **Tip:** Make sure you type `wordpress` in the first box as the text displayed is only a suggestion, the box is blank. + +``` +Database Name: wordpress +User Name: root +Password: +Database Host: localhost +Table Prefix: wp_ +``` + +Click **Submit** to proceed. + +--- /task --- + + +--- task --- + +Click the **Run the install** button. + +--- /task --- + +--- task --- + +Fill in the information you are asked for, then click the `Install WordPress` button. + +--- /task --- + +--- task --- + +Log in, using the account you just created. + +Now you're logged in and have your site set up, you can see the website by visiting your `http://localhost/wp-admin`. + +--- /task --- + + +### Friendly permalinks + +It's recommended that you change your permalink settings to make your URLs more friendly. + +--- task --- + +Log in to WordPress and go to the dashboard. + +--- /task --- + +--- task --- + +Go to **Setting**, then **Permalinks**. + +--- /task --- + +--- task --- + +Select the **Post name** option and click **Save Changes**. + +--- /task --- + +--- task --- + +Type the following command in a terminal to enable Apache's `rewrite` mod: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo a2enmod rewrite + +--- /code --- + +--- /task --- + +--- task --- + +Open the Apache configuration file + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo geany /etc/apache2/sites-available/000-default.conf + +--- /code --- + +--- /task --- + +--- task --- + +Add the following lines after line 1. + +--- code --- +--- +language: sql line_numbers: true line_number_start: 2 +line_highlights: 3-5 +--- + AllowOverride All + +--- /code --- + +--- /task --- + +--- task --- + +Save the file and close Geany. + +--- /task --- + +--- task --- + +In a terminal type the command to restart Apache: + + + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo service apache2 restart + +--- /code --- + +--- /task --- \ No newline at end of file diff --git a/af-ZA/step_8.md b/af-ZA/step_8.md new file mode 100644 index 0000000..2e023a0 --- /dev/null +++ b/af-ZA/step_8.md @@ -0,0 +1,17 @@ +## Challenge + +--- challenge --- + +--- task --- + +Add more pages to your website. + +--- /task --- + +--- task --- + +Install a different theme from the Appearance menu. + +--- /task --- + +--- /challenge --- diff --git a/af-ZA/step_9.md b/af-ZA/step_9.md new file mode 100644 index 0000000..fc5847a --- /dev/null +++ b/af-ZA/step_9.md @@ -0,0 +1,3 @@ +## What can you do now? + +You could try setting up a [Python web server with Flask](https://projects.raspberrypi.org/en/projects/python-web-server-with-flask) \ No newline at end of file diff --git a/ar-SA/images/Python-Webserver-with-Wordpress-TILE-01.png b/ar-SA/images/Python-Webserver-with-Wordpress-TILE-01.png new file mode 100644 index 0000000..f632634 Binary files /dev/null and b/ar-SA/images/Python-Webserver-with-Wordpress-TILE-01.png differ diff --git a/ar-SA/images/Python-Webserver-with-Wordpress.png b/ar-SA/images/Python-Webserver-with-Wordpress.png new file mode 100644 index 0000000..07b0191 Binary files /dev/null and b/ar-SA/images/Python-Webserver-with-Wordpress.png differ diff --git a/ar-SA/images/apache-hello-world.png b/ar-SA/images/apache-hello-world.png new file mode 100644 index 0000000..69fb339 Binary files /dev/null and b/ar-SA/images/apache-hello-world.png differ diff --git a/ar-SA/images/apache-it-works.png b/ar-SA/images/apache-it-works.png new file mode 100644 index 0000000..fb71d9f Binary files /dev/null and b/ar-SA/images/apache-it-works.png differ diff --git a/ar-SA/images/banner.png b/ar-SA/images/banner.png new file mode 100644 index 0000000..88a7bfb Binary files /dev/null and b/ar-SA/images/banner.png differ diff --git a/ar-SA/images/create-database.png b/ar-SA/images/create-database.png new file mode 100644 index 0000000..34c91f2 Binary files /dev/null and b/ar-SA/images/create-database.png differ diff --git a/ar-SA/images/hostname.png b/ar-SA/images/hostname.png new file mode 100644 index 0000000..bb50249 Binary files /dev/null and b/ar-SA/images/hostname.png differ diff --git a/ar-SA/images/hostname_annotated.png b/ar-SA/images/hostname_annotated.png new file mode 100644 index 0000000..27b2f08 Binary files /dev/null and b/ar-SA/images/hostname_annotated.png differ diff --git a/ar-SA/images/install_apache.png b/ar-SA/images/install_apache.png new file mode 100644 index 0000000..8b5dab8 Binary files /dev/null and b/ar-SA/images/install_apache.png differ diff --git a/ar-SA/images/wordpress-database-setup.png b/ar-SA/images/wordpress-database-setup.png new file mode 100644 index 0000000..a1b2a91 Binary files /dev/null and b/ar-SA/images/wordpress-database-setup.png differ diff --git a/ar-SA/images/wordpress-information_needed.png b/ar-SA/images/wordpress-information_needed.png new file mode 100644 index 0000000..8119d0a Binary files /dev/null and b/ar-SA/images/wordpress-information_needed.png differ diff --git a/ar-SA/images/wordpress-run-installation.png b/ar-SA/images/wordpress-run-installation.png new file mode 100644 index 0000000..b368d00 Binary files /dev/null and b/ar-SA/images/wordpress-run-installation.png differ diff --git a/ar-SA/images/wordpress-welcome.png b/ar-SA/images/wordpress-welcome.png new file mode 100644 index 0000000..9394739 Binary files /dev/null and b/ar-SA/images/wordpress-welcome.png differ diff --git a/ar-SA/images/wordpress_language.png b/ar-SA/images/wordpress_language.png new file mode 100644 index 0000000..4d44ba3 Binary files /dev/null and b/ar-SA/images/wordpress_language.png differ diff --git a/ar-SA/images/wp-info.png b/ar-SA/images/wp-info.png new file mode 100644 index 0000000..032e62e Binary files /dev/null and b/ar-SA/images/wp-info.png differ diff --git a/ar-SA/meta.yml b/ar-SA/meta.yml new file mode 100644 index 0000000..e87edce --- /dev/null +++ b/ar-SA/meta.yml @@ -0,0 +1,42 @@ +--- +title: Build a LAMP Web Server with WordPress +hero_image: images/banner.png +description: Set up a local server for a website on your Raspberry Pi +original_url: https://raspberrypi.org/learning/lamp-web-server-with-wordpress +theme: turquoise +duration: 2 +listed: true +ingredient: false +copyedit: false +curriculum: 3, design-0, programming-3, phys-comp-0, manufacture-0, community-0 +interests: '' +technologies: raspberry-pi, html-css-javascript +site_areas: codeclub, python +hardware: raspberry-pi +software: html-css-javascript +version: 4 +last_tested: 2017-01-01 +steps: + - + title: المقدمة + - + title: Set up an Apache web server + completion: + - engaged + - + title: Install PHP + - + title: Install MariaDB + - + title: Download WordPress + - + title: Set up your WordPress database + completion: + - internal + - + title: WordPress configuration + completion: + - external + - + title: Challenge + challenge: true diff --git a/ar-SA/step_1.md b/ar-SA/step_1.md new file mode 100644 index 0000000..ba43de3 --- /dev/null +++ b/ar-SA/step_1.md @@ -0,0 +1,12 @@ +## ما الذي ستصنعه +Learn to set up a LAMP (**L**inux, **A**pache, **M**ySQL, **P**HP) stack on your Raspberry Pi and configure it to work as a web server. + + - Install software on your Raspberry Pi + - Install and configure Apache, PHP, and MySQL to create a LAMP web server + - Download WordPress and run it as a local website on your Raspberry Pi + - Configure WordPress and make your website accessible to other devices on your local network + + +### You will need +- A Raspberry Pi computer connected to the internet +- [An up to date install of the Raspberry Pi OS](https://www.raspberrypi.org/downloads/) diff --git a/ar-SA/step_2.md b/ar-SA/step_2.md new file mode 100644 index 0000000..1cb6c47 --- /dev/null +++ b/ar-SA/step_2.md @@ -0,0 +1,110 @@ +## Set up an Apache web server + +Apache is a popular web server application you can install on the Raspberry Pi to allow it to serve web pages. + +On its own, Apache can serve HTML files over HTTP. With additional modules it can serve dynamic web pages using scripting languages such as PHP. + +### Install Apache + +--- task --- + +Open a terminal window by selecting **Accessories** > **Terminal** from the menu. + +--- /task --- + +--- task --- + +Type the following command into the terminal and press Enter to install `apache2` + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo apt install apache2 -y + +--- /code --- + +**Tip:** If you see an error, make sure you are using the latest version of Raspberry Pi OS. + +--- /task --- + + +### Test the web server + +By default, Apache puts a test HTML file in the web folder that you will be able to view from your Pi or another computer on your network. + +--- task --- + +Open Chromium by selecting **Internet** > **Chromium Web Browser** from the menu. + +--- /task --- + +--- task --- + +Type `localhost` in the address bar. + +--- /task --- + +You should see this in your browser window: + +![Apache it works](images/apache-it-works.png) + +This means you have Apache working! + +### Changing the default web page + +This default web page is just a HTML file on the file system. It is located at `/var/www/html/index.html`. + +--- task --- + +Type the following command in the terminal to change to the directory containing the HTML file: + +--- code --- +--- +language: bash +line_numbers: false +--- +cd /var/www/html + +--- /code --- + +--- /task --- + +--- task --- + +Open the `index.html` file using Thonny + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo thonny index.html + +--- /code --- + +--- /task --- + +--- task --- + +Delete the contents of the file, then type a short message and save your changes. + +--- /task --- + +--- task --- + +Go back to Chromium and refresh the browser. You will see your message appear on the web page. + +--- /task --- + +--- collapse --- +--- +title: Access the page from another device on the network +--- + +You can open your web page from any other computer on your network, using the IP address of your Raspberry Pi, e.g. `http://192.168.1.10`. + +To find out your Raspberry Pi's IP address, type `hostname -I` into the terminal window. + +--- /collapse --- diff --git a/ar-SA/step_3.md b/ar-SA/step_3.md new file mode 100644 index 0000000..4bb6e7f --- /dev/null +++ b/ar-SA/step_3.md @@ -0,0 +1,91 @@ +## Install PHP + +PHP is a **preprocessor**: it's code that runs when the server receives a request for a web page via a web browser. It works out what needs to be shown on the page, and then sends that page to the browser. + +--- task --- + +Type the following command in the terminal to install PHP: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo apt install php -y + +--- /code --- + +--- /task --- + +### Test PHP + +--- task --- + +Type this command to delete the `index.html` file from earlier: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo rm index.html + +--- /code --- + +--- /task --- + +--- task --- + +Create a new file called `index.php`: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo thonny index.php + +--- /code --- + +--- /task --- + +--- task --- + +In the Thonny code editor, type this PHP code into the file and save it. + +--- code --- +--- +language: php +line_numbers: false +--- + + +--- /code --- + +--- /task --- + +--- task --- + +Refresh your browser. You should see "hello world". This page is not dynamic, but it is still served by PHP. + +![hello world](images/apache-hello-world.png) + +--- /task --- + + +--- collapse --- +--- +title: I can only see PHP code +--- +If you see the raw PHP above instead of "hello world", use this command to reload and restart Apache: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo service apache2 restart + +--- /code --- + +--- /collapse --- diff --git a/ar-SA/step_4.md b/ar-SA/step_4.md new file mode 100644 index 0000000..cc6eae1 --- /dev/null +++ b/ar-SA/step_4.md @@ -0,0 +1,75 @@ +## Install MariaDB + +MariaDB is a popular database engine. Like PHP, it's widely used on web servers, which is why projects like WordPress use it, and why those projects are so popular. + + +--- task --- + +Type this command to install the MariaDB Server and PHP-MySQL packages: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo apt install mariadb-server php-mysql -y + +--- /code --- + +--- /task --- + +--- task --- + +Now restart Apache: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo service apache2 restart + +--- /code --- + +--- /task --- + +### Set up + +--- task --- + +Run the MySQL secure installation command in the terminal window. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo mysql_secure_installation + +--- /code --- + +--- /task --- + +--- task --- + +Go through the setup wizard using the following answers: + ++ `Enter current password for root (enter for none):` — press **Enter**. + ++ `Switch to unix_socket authentication [Y/n]` - Type in **N** and press **Enter** + ++ `Change the root password?` - Type in **Y** and press **Enter** + ++ `New password:` - Type in a password and press **Enter**, then repeat a second time. **Important:** remember this root password, as you will need it later to set up WordPress. + ++ `Remove anonymous users` - Type in **Y** + ++ `Disallow root login remotely` - Type in **Y** + ++ `Remove test database and access to it` - Type in **Y** + ++ `Reload privilege tables now` - Type in **Y** + +--- /task --- + +When complete, you will see the message `All done!` and `Thanks for using MariaDB!`. diff --git a/ar-SA/step_5.md b/ar-SA/step_5.md new file mode 100644 index 0000000..d34db90 --- /dev/null +++ b/ar-SA/step_5.md @@ -0,0 +1,109 @@ +## Download WordPress + +WordPress is a popular tool used to quickly create a website or blog with an easy to use editor for creating new content. + + +--- task --- + +In your terminal, make sure you are still in the directory `/var/www/html/` + +--- code --- +--- +language: bash +line_numbers: false +--- +cd /var/www/html/ + +--- /code --- + +--- /task --- + +--- task --- + +Delete all the files in the folder. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo rm * + +--- /code --- + +--- /task --- + +--- task --- + +Type this command to download WordPress + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo wget http://wordpress.org/latest.tar.gz + +--- /code --- + +--- /task --- + +--- task --- + +Extract the WordPress software: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo tar xzf latest.tar.gz + +--- /code --- + +--- /task --- + +--- task --- + +Move the contents of the extracted `wordpress` directory to the current directory. **Tip:** Make sure you type the whole command including the dot. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo mv wordpress/* . + +--- /code --- + +--- /task --- + +--- task --- + +Tidy up by removing the download, and the now empty `wordpress` directory. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo rm -rf wordpress latest.tar.gz + +--- /code --- + +--- /task --- + +---task --- + +Change the ownership of all these files to the Apache user: **Tip:** Make sure you type the whole command including the dot. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo chown -R www-data: . + +--- /code --- + +--- /task --- diff --git a/ar-SA/step_6.md b/ar-SA/step_6.md new file mode 100644 index 0000000..eefa5ec --- /dev/null +++ b/ar-SA/step_6.md @@ -0,0 +1,95 @@ +## Set up your WordPress Database + +--- task --- + +Run `mysql` in the terminal window: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo mysql -uroot -p + +--- /code --- + +--- /task --- + +--- task --- + +Enter the root password you created when you set up the database. + +You will see the message `Welcome to the MariaDB monitor` and then the `MariaDB [(none)]>` prompt. + +--- /task --- + +--- task --- + +At the `MariaDB [(none)]>` prompt, type: **Tip:** Don't forget to type the semicolon at the end. + +--- code --- +--- +language: sql +line_numbers: false +--- +create database wordpress; + +--- /code --- + + + +--- /task --- + +If this has been successful, you should see `Query OK, 1 row affected (0.00 sec)`. + +--- task --- + +At the MariaDB prompt, grant database privileges to the root user. Change `YOURPASSWORD` to the password you created before. + +--- code --- +--- +language: sql +line_numbers: false +--- + +GRANT ALL PRIVILEGES ON wordpress.* TO 'root'@'localhost' IDENTIFIED BY 'YOURPASSWORD'; + +--- /code --- + +--- /task --- + +--- task --- + +For the changes to take effect, you will need to flush the database privileges: + +--- code --- +--- +language: sql +line_numbers: false +--- +FLUSH PRIVILEGES; + +--- /code --- + +--- /task --- + +--- task --- + +Exit the MariaDB prompt with Ctrl + D. + +--- /task --- + +--- task --- + +Restart your Raspberry Pi by typing this command in the terminal: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo reboot + +--- /code --- + +--- /task --- diff --git a/ar-SA/step_7.md b/ar-SA/step_7.md new file mode 100644 index 0000000..be18128 --- /dev/null +++ b/ar-SA/step_7.md @@ -0,0 +1,155 @@ +## WordPress configuration + +--- task --- + +Once your Raspberry Pi has rebooted, open Chromium and type `localhost` into the address bar. + +You should see a WordPress page asking to pick your language. + +![WordPress select language](images/wordpress_language.png) + +--- /task --- + +--- task --- + +Select your language and click **Continue**. + +--- /task --- + +You will be presented with the WordPress welcome screen. + +![WordPress welcome screen](images/wordpress-welcome.png) + +--- task --- + +Click the **Let's go!** button. + +--- /task --- + +--- task --- + +Now fill out the basic site information as follows: **Tip:** Make sure you type `wordpress` in the first box as the text displayed is only a suggestion, the box is blank. + +``` +Database Name: wordpress +User Name: root +Password: +Database Host: localhost +Table Prefix: wp_ +``` + +Click **Submit** to proceed. + +--- /task --- + + +--- task --- + +Click the **Run the install** button. + +--- /task --- + +--- task --- + +Fill in the information you are asked for, then click the `Install WordPress` button. + +--- /task --- + +--- task --- + +Log in, using the account you just created. + +Now you're logged in and have your site set up, you can see the website by visiting your `http://localhost/wp-admin`. + +--- /task --- + + +### Friendly permalinks + +It's recommended that you change your permalink settings to make your URLs more friendly. + +--- task --- + +Log in to WordPress and go to the dashboard. + +--- /task --- + +--- task --- + +Go to **Setting**, then **Permalinks**. + +--- /task --- + +--- task --- + +Select the **Post name** option and click **Save Changes**. + +--- /task --- + +--- task --- + +Type the following command in a terminal to enable Apache's `rewrite` mod: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo a2enmod rewrite + +--- /code --- + +--- /task --- + +--- task --- + +Open the Apache configuration file + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo geany /etc/apache2/sites-available/000-default.conf + +--- /code --- + +--- /task --- + +--- task --- + +Add the following lines after line 1. + +--- code --- +--- +language: sql line_numbers: true line_number_start: 2 +line_highlights: 3-5 +--- + AllowOverride All + +--- /code --- + +--- /task --- + +--- task --- + +Save the file and close Geany. + +--- /task --- + +--- task --- + +In a terminal type the command to restart Apache: + + + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo service apache2 restart + +--- /code --- + +--- /task --- \ No newline at end of file diff --git a/ar-SA/step_8.md b/ar-SA/step_8.md new file mode 100644 index 0000000..2e023a0 --- /dev/null +++ b/ar-SA/step_8.md @@ -0,0 +1,17 @@ +## Challenge + +--- challenge --- + +--- task --- + +Add more pages to your website. + +--- /task --- + +--- task --- + +Install a different theme from the Appearance menu. + +--- /task --- + +--- /challenge --- diff --git a/ar-SA/step_9.md b/ar-SA/step_9.md new file mode 100644 index 0000000..fc5847a --- /dev/null +++ b/ar-SA/step_9.md @@ -0,0 +1,3 @@ +## What can you do now? + +You could try setting up a [Python web server with Flask](https://projects.raspberrypi.org/en/projects/python-web-server-with-flask) \ No newline at end of file diff --git a/ca-ES/images/Python-Webserver-with-Wordpress-TILE-01.png b/ca-ES/images/Python-Webserver-with-Wordpress-TILE-01.png new file mode 100644 index 0000000..f632634 Binary files /dev/null and b/ca-ES/images/Python-Webserver-with-Wordpress-TILE-01.png differ diff --git a/ca-ES/images/Python-Webserver-with-Wordpress.png b/ca-ES/images/Python-Webserver-with-Wordpress.png new file mode 100644 index 0000000..07b0191 Binary files /dev/null and b/ca-ES/images/Python-Webserver-with-Wordpress.png differ diff --git a/ca-ES/images/apache-hello-world.png b/ca-ES/images/apache-hello-world.png new file mode 100644 index 0000000..69fb339 Binary files /dev/null and b/ca-ES/images/apache-hello-world.png differ diff --git a/ca-ES/images/apache-it-works.png b/ca-ES/images/apache-it-works.png new file mode 100644 index 0000000..fb71d9f Binary files /dev/null and b/ca-ES/images/apache-it-works.png differ diff --git a/ca-ES/images/banner.png b/ca-ES/images/banner.png new file mode 100644 index 0000000..88a7bfb Binary files /dev/null and b/ca-ES/images/banner.png differ diff --git a/ca-ES/images/create-database.png b/ca-ES/images/create-database.png new file mode 100644 index 0000000..34c91f2 Binary files /dev/null and b/ca-ES/images/create-database.png differ diff --git a/ca-ES/images/hostname.png b/ca-ES/images/hostname.png new file mode 100644 index 0000000..bb50249 Binary files /dev/null and b/ca-ES/images/hostname.png differ diff --git a/ca-ES/images/hostname_annotated.png b/ca-ES/images/hostname_annotated.png new file mode 100644 index 0000000..27b2f08 Binary files /dev/null and b/ca-ES/images/hostname_annotated.png differ diff --git a/ca-ES/images/install_apache.png b/ca-ES/images/install_apache.png new file mode 100644 index 0000000..8b5dab8 Binary files /dev/null and b/ca-ES/images/install_apache.png differ diff --git a/ca-ES/images/wordpress-database-setup.png b/ca-ES/images/wordpress-database-setup.png new file mode 100644 index 0000000..a1b2a91 Binary files /dev/null and b/ca-ES/images/wordpress-database-setup.png differ diff --git a/ca-ES/images/wordpress-information_needed.png b/ca-ES/images/wordpress-information_needed.png new file mode 100644 index 0000000..8119d0a Binary files /dev/null and b/ca-ES/images/wordpress-information_needed.png differ diff --git a/ca-ES/images/wordpress-run-installation.png b/ca-ES/images/wordpress-run-installation.png new file mode 100644 index 0000000..b368d00 Binary files /dev/null and b/ca-ES/images/wordpress-run-installation.png differ diff --git a/ca-ES/images/wordpress-welcome.png b/ca-ES/images/wordpress-welcome.png new file mode 100644 index 0000000..9394739 Binary files /dev/null and b/ca-ES/images/wordpress-welcome.png differ diff --git a/ca-ES/images/wordpress_language.png b/ca-ES/images/wordpress_language.png new file mode 100644 index 0000000..4d44ba3 Binary files /dev/null and b/ca-ES/images/wordpress_language.png differ diff --git a/ca-ES/images/wp-info.png b/ca-ES/images/wp-info.png new file mode 100644 index 0000000..032e62e Binary files /dev/null and b/ca-ES/images/wp-info.png differ diff --git a/ca-ES/meta.yml b/ca-ES/meta.yml new file mode 100644 index 0000000..9e9eef8 --- /dev/null +++ b/ca-ES/meta.yml @@ -0,0 +1,42 @@ +--- +title: Build a LAMP Web Server with WordPress +hero_image: images/banner.png +description: Set up a local server for a website on your Raspberry Pi +original_url: https://raspberrypi.org/learning/lamp-web-server-with-wordpress +theme: turquoise +duration: 2 +listed: true +ingredient: false +copyedit: false +curriculum: 3, disseny-0, programació-3, phys-comp-0, fabricació-0, comunitat-0 +interests: '' +technologies: raspberry-pi, html-css-javascript +site_areas: projectes +hardware: raspberry-pi +software: html-css-javascript +version: 4 +last_tested: 2017-01-01 +steps: + - + title: Introducció + - + title: Set up an Apache web server + completion: + - engaged + - + title: Install PHP + - + title: Install MariaDB + - + title: Download WordPress + - + title: Set up your WordPress database + completion: + - internal + - + title: WordPress configuration + completion: + - external + - + title: Challenge + challenge: true diff --git a/ca-ES/step_1.md b/ca-ES/step_1.md new file mode 100644 index 0000000..241398c --- /dev/null +++ b/ca-ES/step_1.md @@ -0,0 +1,12 @@ +## Què faràs +Learn to set up a LAMP (**L**inux, **A**pache, **M**ySQL, **P**HP) stack on your Raspberry Pi and configure it to work as a web server. + + - Install software on your Raspberry Pi + - Install and configure Apache, PHP, and MySQL to create a LAMP web server + - Download WordPress and run it as a local website on your Raspberry Pi + - Configure WordPress and make your website accessible to other devices on your local network + + +### You will need +- A Raspberry Pi computer connected to the internet +- [An up to date install of the Raspberry Pi OS](https://www.raspberrypi.org/downloads/) diff --git a/ca-ES/step_2.md b/ca-ES/step_2.md new file mode 100644 index 0000000..1cb6c47 --- /dev/null +++ b/ca-ES/step_2.md @@ -0,0 +1,110 @@ +## Set up an Apache web server + +Apache is a popular web server application you can install on the Raspberry Pi to allow it to serve web pages. + +On its own, Apache can serve HTML files over HTTP. With additional modules it can serve dynamic web pages using scripting languages such as PHP. + +### Install Apache + +--- task --- + +Open a terminal window by selecting **Accessories** > **Terminal** from the menu. + +--- /task --- + +--- task --- + +Type the following command into the terminal and press Enter to install `apache2` + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo apt install apache2 -y + +--- /code --- + +**Tip:** If you see an error, make sure you are using the latest version of Raspberry Pi OS. + +--- /task --- + + +### Test the web server + +By default, Apache puts a test HTML file in the web folder that you will be able to view from your Pi or another computer on your network. + +--- task --- + +Open Chromium by selecting **Internet** > **Chromium Web Browser** from the menu. + +--- /task --- + +--- task --- + +Type `localhost` in the address bar. + +--- /task --- + +You should see this in your browser window: + +![Apache it works](images/apache-it-works.png) + +This means you have Apache working! + +### Changing the default web page + +This default web page is just a HTML file on the file system. It is located at `/var/www/html/index.html`. + +--- task --- + +Type the following command in the terminal to change to the directory containing the HTML file: + +--- code --- +--- +language: bash +line_numbers: false +--- +cd /var/www/html + +--- /code --- + +--- /task --- + +--- task --- + +Open the `index.html` file using Thonny + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo thonny index.html + +--- /code --- + +--- /task --- + +--- task --- + +Delete the contents of the file, then type a short message and save your changes. + +--- /task --- + +--- task --- + +Go back to Chromium and refresh the browser. You will see your message appear on the web page. + +--- /task --- + +--- collapse --- +--- +title: Access the page from another device on the network +--- + +You can open your web page from any other computer on your network, using the IP address of your Raspberry Pi, e.g. `http://192.168.1.10`. + +To find out your Raspberry Pi's IP address, type `hostname -I` into the terminal window. + +--- /collapse --- diff --git a/ca-ES/step_3.md b/ca-ES/step_3.md new file mode 100644 index 0000000..4bb6e7f --- /dev/null +++ b/ca-ES/step_3.md @@ -0,0 +1,91 @@ +## Install PHP + +PHP is a **preprocessor**: it's code that runs when the server receives a request for a web page via a web browser. It works out what needs to be shown on the page, and then sends that page to the browser. + +--- task --- + +Type the following command in the terminal to install PHP: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo apt install php -y + +--- /code --- + +--- /task --- + +### Test PHP + +--- task --- + +Type this command to delete the `index.html` file from earlier: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo rm index.html + +--- /code --- + +--- /task --- + +--- task --- + +Create a new file called `index.php`: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo thonny index.php + +--- /code --- + +--- /task --- + +--- task --- + +In the Thonny code editor, type this PHP code into the file and save it. + +--- code --- +--- +language: php +line_numbers: false +--- + + +--- /code --- + +--- /task --- + +--- task --- + +Refresh your browser. You should see "hello world". This page is not dynamic, but it is still served by PHP. + +![hello world](images/apache-hello-world.png) + +--- /task --- + + +--- collapse --- +--- +title: I can only see PHP code +--- +If you see the raw PHP above instead of "hello world", use this command to reload and restart Apache: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo service apache2 restart + +--- /code --- + +--- /collapse --- diff --git a/ca-ES/step_4.md b/ca-ES/step_4.md new file mode 100644 index 0000000..cc6eae1 --- /dev/null +++ b/ca-ES/step_4.md @@ -0,0 +1,75 @@ +## Install MariaDB + +MariaDB is a popular database engine. Like PHP, it's widely used on web servers, which is why projects like WordPress use it, and why those projects are so popular. + + +--- task --- + +Type this command to install the MariaDB Server and PHP-MySQL packages: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo apt install mariadb-server php-mysql -y + +--- /code --- + +--- /task --- + +--- task --- + +Now restart Apache: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo service apache2 restart + +--- /code --- + +--- /task --- + +### Set up + +--- task --- + +Run the MySQL secure installation command in the terminal window. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo mysql_secure_installation + +--- /code --- + +--- /task --- + +--- task --- + +Go through the setup wizard using the following answers: + ++ `Enter current password for root (enter for none):` — press **Enter**. + ++ `Switch to unix_socket authentication [Y/n]` - Type in **N** and press **Enter** + ++ `Change the root password?` - Type in **Y** and press **Enter** + ++ `New password:` - Type in a password and press **Enter**, then repeat a second time. **Important:** remember this root password, as you will need it later to set up WordPress. + ++ `Remove anonymous users` - Type in **Y** + ++ `Disallow root login remotely` - Type in **Y** + ++ `Remove test database and access to it` - Type in **Y** + ++ `Reload privilege tables now` - Type in **Y** + +--- /task --- + +When complete, you will see the message `All done!` and `Thanks for using MariaDB!`. diff --git a/ca-ES/step_5.md b/ca-ES/step_5.md new file mode 100644 index 0000000..d34db90 --- /dev/null +++ b/ca-ES/step_5.md @@ -0,0 +1,109 @@ +## Download WordPress + +WordPress is a popular tool used to quickly create a website or blog with an easy to use editor for creating new content. + + +--- task --- + +In your terminal, make sure you are still in the directory `/var/www/html/` + +--- code --- +--- +language: bash +line_numbers: false +--- +cd /var/www/html/ + +--- /code --- + +--- /task --- + +--- task --- + +Delete all the files in the folder. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo rm * + +--- /code --- + +--- /task --- + +--- task --- + +Type this command to download WordPress + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo wget http://wordpress.org/latest.tar.gz + +--- /code --- + +--- /task --- + +--- task --- + +Extract the WordPress software: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo tar xzf latest.tar.gz + +--- /code --- + +--- /task --- + +--- task --- + +Move the contents of the extracted `wordpress` directory to the current directory. **Tip:** Make sure you type the whole command including the dot. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo mv wordpress/* . + +--- /code --- + +--- /task --- + +--- task --- + +Tidy up by removing the download, and the now empty `wordpress` directory. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo rm -rf wordpress latest.tar.gz + +--- /code --- + +--- /task --- + +---task --- + +Change the ownership of all these files to the Apache user: **Tip:** Make sure you type the whole command including the dot. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo chown -R www-data: . + +--- /code --- + +--- /task --- diff --git a/ca-ES/step_6.md b/ca-ES/step_6.md new file mode 100644 index 0000000..eefa5ec --- /dev/null +++ b/ca-ES/step_6.md @@ -0,0 +1,95 @@ +## Set up your WordPress Database + +--- task --- + +Run `mysql` in the terminal window: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo mysql -uroot -p + +--- /code --- + +--- /task --- + +--- task --- + +Enter the root password you created when you set up the database. + +You will see the message `Welcome to the MariaDB monitor` and then the `MariaDB [(none)]>` prompt. + +--- /task --- + +--- task --- + +At the `MariaDB [(none)]>` prompt, type: **Tip:** Don't forget to type the semicolon at the end. + +--- code --- +--- +language: sql +line_numbers: false +--- +create database wordpress; + +--- /code --- + + + +--- /task --- + +If this has been successful, you should see `Query OK, 1 row affected (0.00 sec)`. + +--- task --- + +At the MariaDB prompt, grant database privileges to the root user. Change `YOURPASSWORD` to the password you created before. + +--- code --- +--- +language: sql +line_numbers: false +--- + +GRANT ALL PRIVILEGES ON wordpress.* TO 'root'@'localhost' IDENTIFIED BY 'YOURPASSWORD'; + +--- /code --- + +--- /task --- + +--- task --- + +For the changes to take effect, you will need to flush the database privileges: + +--- code --- +--- +language: sql +line_numbers: false +--- +FLUSH PRIVILEGES; + +--- /code --- + +--- /task --- + +--- task --- + +Exit the MariaDB prompt with Ctrl + D. + +--- /task --- + +--- task --- + +Restart your Raspberry Pi by typing this command in the terminal: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo reboot + +--- /code --- + +--- /task --- diff --git a/ca-ES/step_7.md b/ca-ES/step_7.md new file mode 100644 index 0000000..be18128 --- /dev/null +++ b/ca-ES/step_7.md @@ -0,0 +1,155 @@ +## WordPress configuration + +--- task --- + +Once your Raspberry Pi has rebooted, open Chromium and type `localhost` into the address bar. + +You should see a WordPress page asking to pick your language. + +![WordPress select language](images/wordpress_language.png) + +--- /task --- + +--- task --- + +Select your language and click **Continue**. + +--- /task --- + +You will be presented with the WordPress welcome screen. + +![WordPress welcome screen](images/wordpress-welcome.png) + +--- task --- + +Click the **Let's go!** button. + +--- /task --- + +--- task --- + +Now fill out the basic site information as follows: **Tip:** Make sure you type `wordpress` in the first box as the text displayed is only a suggestion, the box is blank. + +``` +Database Name: wordpress +User Name: root +Password: +Database Host: localhost +Table Prefix: wp_ +``` + +Click **Submit** to proceed. + +--- /task --- + + +--- task --- + +Click the **Run the install** button. + +--- /task --- + +--- task --- + +Fill in the information you are asked for, then click the `Install WordPress` button. + +--- /task --- + +--- task --- + +Log in, using the account you just created. + +Now you're logged in and have your site set up, you can see the website by visiting your `http://localhost/wp-admin`. + +--- /task --- + + +### Friendly permalinks + +It's recommended that you change your permalink settings to make your URLs more friendly. + +--- task --- + +Log in to WordPress and go to the dashboard. + +--- /task --- + +--- task --- + +Go to **Setting**, then **Permalinks**. + +--- /task --- + +--- task --- + +Select the **Post name** option and click **Save Changes**. + +--- /task --- + +--- task --- + +Type the following command in a terminal to enable Apache's `rewrite` mod: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo a2enmod rewrite + +--- /code --- + +--- /task --- + +--- task --- + +Open the Apache configuration file + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo geany /etc/apache2/sites-available/000-default.conf + +--- /code --- + +--- /task --- + +--- task --- + +Add the following lines after line 1. + +--- code --- +--- +language: sql line_numbers: true line_number_start: 2 +line_highlights: 3-5 +--- + AllowOverride All + +--- /code --- + +--- /task --- + +--- task --- + +Save the file and close Geany. + +--- /task --- + +--- task --- + +In a terminal type the command to restart Apache: + + + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo service apache2 restart + +--- /code --- + +--- /task --- \ No newline at end of file diff --git a/ca-ES/step_8.md b/ca-ES/step_8.md new file mode 100644 index 0000000..2e023a0 --- /dev/null +++ b/ca-ES/step_8.md @@ -0,0 +1,17 @@ +## Challenge + +--- challenge --- + +--- task --- + +Add more pages to your website. + +--- /task --- + +--- task --- + +Install a different theme from the Appearance menu. + +--- /task --- + +--- /challenge --- diff --git a/ca-ES/step_9.md b/ca-ES/step_9.md new file mode 100644 index 0000000..fc5847a --- /dev/null +++ b/ca-ES/step_9.md @@ -0,0 +1,3 @@ +## What can you do now? + +You could try setting up a [Python web server with Flask](https://projects.raspberrypi.org/en/projects/python-web-server-with-flask) \ No newline at end of file diff --git a/cs-CZ/images/Python-Webserver-with-Wordpress-TILE-01.png b/cs-CZ/images/Python-Webserver-with-Wordpress-TILE-01.png new file mode 100644 index 0000000..f632634 Binary files /dev/null and b/cs-CZ/images/Python-Webserver-with-Wordpress-TILE-01.png differ diff --git a/cs-CZ/images/Python-Webserver-with-Wordpress.png b/cs-CZ/images/Python-Webserver-with-Wordpress.png new file mode 100644 index 0000000..07b0191 Binary files /dev/null and b/cs-CZ/images/Python-Webserver-with-Wordpress.png differ diff --git a/cs-CZ/images/apache-hello-world.png b/cs-CZ/images/apache-hello-world.png new file mode 100644 index 0000000..69fb339 Binary files /dev/null and b/cs-CZ/images/apache-hello-world.png differ diff --git a/cs-CZ/images/apache-it-works.png b/cs-CZ/images/apache-it-works.png new file mode 100644 index 0000000..fb71d9f Binary files /dev/null and b/cs-CZ/images/apache-it-works.png differ diff --git a/cs-CZ/images/banner.png b/cs-CZ/images/banner.png new file mode 100644 index 0000000..88a7bfb Binary files /dev/null and b/cs-CZ/images/banner.png differ diff --git a/cs-CZ/images/create-database.png b/cs-CZ/images/create-database.png new file mode 100644 index 0000000..34c91f2 Binary files /dev/null and b/cs-CZ/images/create-database.png differ diff --git a/cs-CZ/images/hostname.png b/cs-CZ/images/hostname.png new file mode 100644 index 0000000..bb50249 Binary files /dev/null and b/cs-CZ/images/hostname.png differ diff --git a/cs-CZ/images/hostname_annotated.png b/cs-CZ/images/hostname_annotated.png new file mode 100644 index 0000000..27b2f08 Binary files /dev/null and b/cs-CZ/images/hostname_annotated.png differ diff --git a/cs-CZ/images/install_apache.png b/cs-CZ/images/install_apache.png new file mode 100644 index 0000000..8b5dab8 Binary files /dev/null and b/cs-CZ/images/install_apache.png differ diff --git a/cs-CZ/images/wordpress-database-setup.png b/cs-CZ/images/wordpress-database-setup.png new file mode 100644 index 0000000..a1b2a91 Binary files /dev/null and b/cs-CZ/images/wordpress-database-setup.png differ diff --git a/cs-CZ/images/wordpress-information_needed.png b/cs-CZ/images/wordpress-information_needed.png new file mode 100644 index 0000000..8119d0a Binary files /dev/null and b/cs-CZ/images/wordpress-information_needed.png differ diff --git a/cs-CZ/images/wordpress-run-installation.png b/cs-CZ/images/wordpress-run-installation.png new file mode 100644 index 0000000..b368d00 Binary files /dev/null and b/cs-CZ/images/wordpress-run-installation.png differ diff --git a/cs-CZ/images/wordpress-welcome.png b/cs-CZ/images/wordpress-welcome.png new file mode 100644 index 0000000..9394739 Binary files /dev/null and b/cs-CZ/images/wordpress-welcome.png differ diff --git a/cs-CZ/images/wordpress_language.png b/cs-CZ/images/wordpress_language.png new file mode 100644 index 0000000..4d44ba3 Binary files /dev/null and b/cs-CZ/images/wordpress_language.png differ diff --git a/cs-CZ/images/wp-info.png b/cs-CZ/images/wp-info.png new file mode 100644 index 0000000..032e62e Binary files /dev/null and b/cs-CZ/images/wp-info.png differ diff --git a/cs-CZ/meta.yml b/cs-CZ/meta.yml new file mode 100644 index 0000000..67bec57 --- /dev/null +++ b/cs-CZ/meta.yml @@ -0,0 +1,42 @@ +--- +title: Vytvoř si webový server LAMP s WordPressem +hero_image: images/banner.png +description: Nastavení lokálního serveru pro webovou stránku na Raspberry Pi +original_url: https://raspberrypi.org/learning/lamp-web-server-with-wordpress +theme: turquoise +duration: 2 +listed: true +ingredient: false +copyedit: false +curriculum: 3, design-0, programming-3, phys-comp-0, manufacture-0, community-0 +interests: '' +technologies: raspberry-pi, html-css-javascript +site_areas: projects +hardware: raspberry-pi +software: html-css-javascript +version: 4 +last_tested: 2017-01-01 +steps: + - + title: Úvod + - + title: Nastavení webového serveru Apache + completion: + - engaged + - + title: Instalace PHP + - + title: Instalace MariaDB + - + title: Stažení nástroje WordPress + - + title: Nastavení databáze pro WordPress + completion: + - internal + - + title: Konfigurace WordPressu + completion: + - external + - + title: Výzva + challenge: true diff --git a/cs-CZ/step_1.md b/cs-CZ/step_1.md new file mode 100644 index 0000000..93c3188 --- /dev/null +++ b/cs-CZ/step_1.md @@ -0,0 +1,12 @@ +## Co budeš dělat +Nauč se nastavit LAMP (**L**inux, **A**pache, **M**ySQL, **P**HP) stack na Raspberry Pi a nakonfigurovat ho tak, aby fungoval jako webový server. + + - Nainstaluj si software na Raspberry Pi + - Nainstaluj a nakonfiguruj Apache, PHP a MySQL pro vytvoření webového serveru LAMP + - Stáhni si WordPress a spusť lokální webovou stránku na Raspberry Pi + - Nakonfiguruj WordPress a zpřístupni svůj web ostatním zařízením ve tvé lokální síti + + +### Co budeš potřebovat +- Počítač Raspberry Pi připojený k internetu +- [Aktuální instalaci operačního systému Raspberry Pi](https://www.raspberrypi.org/downloads/) diff --git a/cs-CZ/step_2.md b/cs-CZ/step_2.md new file mode 100644 index 0000000..04ef9eb --- /dev/null +++ b/cs-CZ/step_2.md @@ -0,0 +1,110 @@ +## Nastavení webového serveru Apache + +Apache je populární webový server, který si můžete nainstalovat na Raspberry Pi a umožnit mu zobrazování webových stránek. + +Apache sám o sobě dokáže obsluhovat HTML soubory přes HTTP. S dalšími moduly může zobrazovat dynamické webové stránky pomocí skriptovacích jazyků, jako je PHP. + +### Instalace Apache + +--- task --- + +Otevři okno terminálu výběrem možnosti **Příslušenství** > **Terminál** z nabídky. + +--- /task --- + +--- task --- + +Zadej do terminálu následující příkaz a stiskni Enter pro instalaci `apache2` + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo apt install apache2 -y + +--- /code --- + +**Tip:** Pokud se zobrazí chyba, ujisti se, že používáš nejnovější a aktualizovanou verzi operačního systému Raspberry Pi. + +--- /task --- + + +### Otestuj webový server + +Ve výchozím nastavení Apache umístí do webové složky testovací HTML soubor, který si budeš moci prohlížet z tvého Raspberry Pi nebo jiného počítače v síti. + +--- task --- + +Otevři Chromium výběrem možnosti **Internet** > **Webový prohlížeč Chromium** z nabídky. + +--- /task --- + +--- task --- + +Do adresního řádku zadej `localhost`. + +--- /task --- + +Toto bys měl vidět v okně prohlížeče: + +![Apache2 funguje](images/apache-it-works.png) + +To znamená, že máš Apache funkční! + +### Změna výchozí webové stránky + +Tato výchozí webová stránka je pouze soubor HTML v souborovém systému. Nachází se na adrese `/var/www/html/index.html`. + +--- task --- + +Zadej do terminálu následující příkaz pro přechod do adresáře obsahujícího soubor HTML: + +--- code --- +--- +language: bash +line_numbers: false +--- +cd /var/www/html + +--- /code --- + +--- /task --- + +--- task --- + +Otevři soubor `index.html` pomocí Thonny + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo thonny index.html + +--- /code --- + +--- /task --- + +--- task --- + +Smaž obsah souboru, poté napiš krátkou zprávu a ulož změny. + +--- /task --- + +--- task --- + +Vrať se do Chromia a obnov prohlížeč. Tvá zpráva se zobrazí na webové stránce. + +--- /task --- + +--- collapse --- +--- +title: Přístup ke stránce z jiného zařízení v síti +--- + +Svou webovou stránku můžete otevřít z jakéhokoli jiného počítače v síti pomocí IP adresy vašeho Raspberry Pi, např. `http://192.168.1.10`. + +Chceš-li zjistit IP adresu tvého Raspberry Pi, zadej do terminálového okna `hostname -I`. + +--- /collapse --- diff --git a/cs-CZ/step_3.md b/cs-CZ/step_3.md new file mode 100644 index 0000000..4411977 --- /dev/null +++ b/cs-CZ/step_3.md @@ -0,0 +1,91 @@ +## Instalace PHP + +PHP je **preprocesor**: je to kód, který se spustí, když server obdrží požadavek na webovou stránku prostřednictvím webového prohlížeče. Zjistí, co se má na stránce zobrazit, a poté tuto stránku odešle do prohlížeče. + +--- task --- + +Pro instalaci PHP zadej do terminálu následující příkaz: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo apt install php -y + +--- /code --- + +--- /task --- + +### Test PHP + +--- task --- + +Zadej tento příkaz pro odstranění souboru `index.html` z dřívější doby: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo rm index.html + +--- /code --- + +--- /task --- + +--- task --- + +Vytvoř nový soubor s názvem `index.php`: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo thonny index.php + +--- /code --- + +--- /task --- + +--- task --- + +V editoru kódu Thonny zadej tento PHP kód do souboru a ulož jej. + +--- code --- +--- +language: php +line_numbers: false +--- + + +--- /code --- + +--- /task --- + +--- task --- + +Obnov prohlížeč. Měl bys vidět „ahoj světe“. Tato stránka není dynamická, ale stále je obsluhována PHP. + +![ahoj světe](images/apache-hello-world.png) + +--- /task --- + + +--- collapse --- +--- +title: Vidím pouze PHP kód +--- +Pokud se ti místo „ahoj světe“ zobrazí nezpracované PHP, použij tento příkaz k opětovnému spuštění a restartování Apache: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo service apache2 restart + +--- /code --- + +--- /collapse --- diff --git a/cs-CZ/step_4.md b/cs-CZ/step_4.md new file mode 100644 index 0000000..59ca4f7 --- /dev/null +++ b/cs-CZ/step_4.md @@ -0,0 +1,75 @@ +## Instalace MariaDB + +MariaDB je populární databázový engine. Stejně jako PHP se hojně používá na webových serverech, a proto ho používají projekty jako WordPress a proč jsou tyto projekty tak populární. + + +--- task --- + +Zadej tento příkaz pro instalaci balíčků MariaDB Server a PHP-MySQL: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo apt install mariadb-server php-mysql -y + +--- /code --- + +--- /task --- + +--- task --- + +Nyní restartuj Apache: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo service apache2 restart + +--- /code --- + +--- /task --- + +### Nastavení + +--- task --- + +Spusť příkaz pro bezpečnou instalaci MySQL v terminálovém okně. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo mysql_secure_installation + +--- /code --- + +--- /task --- + +--- task --- + +Projdi si průvodce nastavením pomocí následujících odpovědí: + ++ `Zadej aktuální heslo pro root (enter, pokud žádné nemáš):` — stiskni **Enter**. + ++ `Přepnout na ověřování unix_socket [A/n]` - Zadejte **N** a stiskněte **Enter** + ++ `Změnit heslo roota?` - Zadej **Y** a stiskni **Enter** + ++ `Nové heslo:` - Zadej heslo a stiskni **Enter**a poté opakuj podruhé. **Důležité:** zapamatuj si toto heslo root, protože ho budeš později potřebovat k nastavení WordPressu. + ++ `Odebrat anonymní uživatele` - Zadej **Y** + ++ `Zakázat vzdálené přihlášení root` - Zadej **Y** + ++ `Odebrat testovací databázi a přístup k ní` - Zadej **Y** + ++ `Znovu načíst tabulky oprávnění` - Zadej **Y** + +--- /task --- + +Po dokončení se zobrazí zpráva `All done!` a `Thanks for using MariaDB!`. diff --git a/cs-CZ/step_5.md b/cs-CZ/step_5.md new file mode 100644 index 0000000..9fdb877 --- /dev/null +++ b/cs-CZ/step_5.md @@ -0,0 +1,109 @@ +## Stažení nástroje WordPress + +WordPress je oblíbený nástroj používaný k rychlé tvorbě webových stránek nebo blogů s snadno použitelným editorem pro tvorbu nového obsahu. + + +--- task --- + +V terminálu se ujistěti, že jsi stále v adresáři `/var/www/html/` + +--- code --- +--- +language: bash +line_numbers: false +--- +cd /var/www/html/ + +--- /code --- + +--- /task --- + +--- task --- + +Smaž všechny soubory ve složce. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo rm * + +--- /code --- + +--- /task --- + +--- task --- + +Zadej tento příkaz pro stažení WordPressu + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo wget http://wordpress.org/latest.tar.gz + +--- /code --- + +--- /task --- + +--- task --- + +Rozbal software WordPress: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo tar xzf latest.tar.gz + +--- /code --- + +--- /task --- + +--- task --- + +Přesuň obsah extrahovaného adresáře `wordpress` do aktuálního adresáře. **Tip:** Ujisti se, že zadáváš celý příkaz včetně tečky. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo mv wordpress/* . + +--- /code --- + +--- /task --- + +--- task --- + +Smaž stažený soubor a prázdný adresář`wordpress`. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo rm -rf wordpress latest.tar.gz + +--- /code --- + +--- /task --- + +---task --- + +Změň vlastnictví všech těchto souborů na uživatele Apache: **Tip:** Ujisti se, že jsi zadal celý příkaz včetně tečky. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo chown -R www-data: . + +--- /code --- + +--- /task --- diff --git a/cs-CZ/step_6.md b/cs-CZ/step_6.md new file mode 100644 index 0000000..22da56a --- /dev/null +++ b/cs-CZ/step_6.md @@ -0,0 +1,95 @@ +## Nastavení databáze pro WordPress + +--- task --- + +V terminálovém okně spusť `mysql`: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo mysql -uroot -p + +--- /code --- + +--- /task --- + +--- task --- + +Zadej heslo uživatele root, které jsi vytvořil při nastavení databáze. + +Zobrazí se zpráva `Vítejte v monitoru MariaDB` a poté výzva `MariaDB [(none)]>`. + +--- /task --- + +--- task --- + +V příkazovém řádku `MariaDB [(none)]>` zadej: **Tip:** Nezapomeň na konec zadat středník. + +--- code --- +--- +language: sql +line_numbers: false +--- +create database wordpress; + +--- /code --- + + + +--- /task --- + +Pokud se to podařilo, měl bys vidět `Query OK, 1 row affected (0.00 sec)`. + +--- task --- + +V příkazovém řádku MariaDB uděl uživateli root oprávnění k databázi. Změň `YOURPASSWORD` na heslo, které sis vytvořil dříve. + +--- code --- +--- +language: sql +line_numbers: false +--- + +GRANT ALL PRIVILEGES ON wordpress.* TO 'root'@'localhost' IDENTIFIED BY 'YOURPASSWORD'; + +--- /code --- + +--- /task --- + +--- task --- + +Aby se změny projevily, budeš muset obnovit oprávnění databáze: + +--- code --- +--- +language: sql +line_numbers: false +--- +FLUSH PRIVILEGES; + +--- /code --- + +--- /task --- + +--- task --- + +Ukonči příkazový řádek MariaDB stisknutím Ctrl + D. + +--- /task --- + +--- task --- + +Restartuj Raspberry Pi zadáním tohoto příkazu do terminálu: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo reboot + +--- /code --- + +--- /task --- diff --git a/cs-CZ/step_7.md b/cs-CZ/step_7.md new file mode 100644 index 0000000..7e09c09 --- /dev/null +++ b/cs-CZ/step_7.md @@ -0,0 +1,155 @@ +## Konfigurace WordPressu + +--- task --- + +Jakmile se Raspberry Pi restartuje, otevři Chromium a do adresního řádku zadej `localhost`. + +Měl bys vidět stránku WordPressu s výzvou k výběru jazyka. + +![Výběr jazyka WordPressu](images/wordpress_language.png) + +--- /task --- + +--- task --- + +Vyberte jazyk a klikněte na **Pokračovat**. + +--- /task --- + +Zobrazí se vám uvítací obrazovka WordPressu. + +![Úvodní obrazovka WordPressu](images/wordpress-welcome.png) + +--- task --- + +Klikněte na tlačítko **Jdeme na to!**. + +--- /task --- + +--- task --- + +Nyní vyplň základní informace o webu takto: **Tip:** Ujisti se, že do prvního pole zadáš `wordpress`, protože zobrazený text je pouze návrh, pole je prázdné. + +``` +Database Name: wordpress +User Name: root +Password: +Database Host: localhost +Table Prefix: wp_ +``` + +Klikněte na **Odeslat** pro pokračování. + +--- /task --- + + +--- task --- + +Klikněte na tlačítko **Spustit instalaci**. + +--- /task --- + +--- task --- + +Vyplňte požadované informace a poté klikněte na tlačítko `Nainstalovat WordPress`. + +--- /task --- + +--- task --- + +Přihlas se pomocí účtu, který sis právě vytvořil. + +Nyní, když jsi přihlášen a máš nastavené stránky, si je můžeš prohlédnout na adrese `http://localhost/wp-admin`. + +--- /task --- + + +### Přátelské permalinky + +Doporučuje se změnit nastavení trvalých odkazů, aby byly tvé URL adresy uživatelsky přívětivější. + +--- task --- + +Přihlas se do WordPressu a přejdi na dashboard. + +--- /task --- + +--- task --- + +Jdi na **Nastavení**a poté na **Trvalé odkazy**. + +--- /task --- + +--- task --- + +Vyber možnost **Název příspěvku** a klikni na **Uložit změny**. + +--- /task --- + +--- task --- + +Zadej do terminálu následující příkaz, abys povolil mod `rewrite` v Apachi: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo a2enmod rewrite + +--- /code --- + +--- /task --- + +--- task --- + +Otevři konfigurační soubor Apache + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo geany /etc/apache2/sites-available/000-default.conf + +--- /code --- + +--- /task --- + +--- task --- + +Za řádek 1 přidej následující řádky. + +--- code --- +--- +language: sql line_numbers: true line_number_start: 2 +line_highlights: 3-5 +--- + AllowOverride All + +--- /code --- + +--- /task --- + +--- task --- + +Ulož soubor a zavři editor. + +--- /task --- + +--- task --- + +V terminálu zadej příkaz pro restartování Apache: + + + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo service apache2 restart + +--- /code --- + +--- /task --- \ No newline at end of file diff --git a/cs-CZ/step_8.md b/cs-CZ/step_8.md new file mode 100644 index 0000000..3afff98 --- /dev/null +++ b/cs-CZ/step_8.md @@ -0,0 +1,17 @@ +## Výzva + +--- challenge --- + +--- task --- + +Přidej na svůj web další stránky. + +--- /task --- + +--- task --- + +Nainstaluj si jiný motiv z nabídky Vzhled. + +--- /task --- + +--- /challenge --- diff --git a/cs-CZ/step_9.md b/cs-CZ/step_9.md new file mode 100644 index 0000000..5746d3a --- /dev/null +++ b/cs-CZ/step_9.md @@ -0,0 +1,3 @@ +## Co můžeš dělat nyní? + +Můžeš zkusit nastavit [Python webový server s Flaskem](https://projects.raspberrypi.org/en/projects/python-web-server-with-flask) \ No newline at end of file diff --git a/da-DK/images/Python-Webserver-with-Wordpress-TILE-01.png b/da-DK/images/Python-Webserver-with-Wordpress-TILE-01.png new file mode 100644 index 0000000..f632634 Binary files /dev/null and b/da-DK/images/Python-Webserver-with-Wordpress-TILE-01.png differ diff --git a/da-DK/images/Python-Webserver-with-Wordpress.png b/da-DK/images/Python-Webserver-with-Wordpress.png new file mode 100644 index 0000000..07b0191 Binary files /dev/null and b/da-DK/images/Python-Webserver-with-Wordpress.png differ diff --git a/da-DK/images/apache-hello-world.png b/da-DK/images/apache-hello-world.png new file mode 100644 index 0000000..69fb339 Binary files /dev/null and b/da-DK/images/apache-hello-world.png differ diff --git a/da-DK/images/apache-it-works.png b/da-DK/images/apache-it-works.png new file mode 100644 index 0000000..fb71d9f Binary files /dev/null and b/da-DK/images/apache-it-works.png differ diff --git a/da-DK/images/banner.png b/da-DK/images/banner.png new file mode 100644 index 0000000..88a7bfb Binary files /dev/null and b/da-DK/images/banner.png differ diff --git a/da-DK/images/create-database.png b/da-DK/images/create-database.png new file mode 100644 index 0000000..34c91f2 Binary files /dev/null and b/da-DK/images/create-database.png differ diff --git a/da-DK/images/hostname.png b/da-DK/images/hostname.png new file mode 100644 index 0000000..bb50249 Binary files /dev/null and b/da-DK/images/hostname.png differ diff --git a/da-DK/images/hostname_annotated.png b/da-DK/images/hostname_annotated.png new file mode 100644 index 0000000..27b2f08 Binary files /dev/null and b/da-DK/images/hostname_annotated.png differ diff --git a/da-DK/images/install_apache.png b/da-DK/images/install_apache.png new file mode 100644 index 0000000..8b5dab8 Binary files /dev/null and b/da-DK/images/install_apache.png differ diff --git a/da-DK/images/wordpress-database-setup.png b/da-DK/images/wordpress-database-setup.png new file mode 100644 index 0000000..a1b2a91 Binary files /dev/null and b/da-DK/images/wordpress-database-setup.png differ diff --git a/da-DK/images/wordpress-information_needed.png b/da-DK/images/wordpress-information_needed.png new file mode 100644 index 0000000..8119d0a Binary files /dev/null and b/da-DK/images/wordpress-information_needed.png differ diff --git a/da-DK/images/wordpress-run-installation.png b/da-DK/images/wordpress-run-installation.png new file mode 100644 index 0000000..b368d00 Binary files /dev/null and b/da-DK/images/wordpress-run-installation.png differ diff --git a/da-DK/images/wordpress-welcome.png b/da-DK/images/wordpress-welcome.png new file mode 100644 index 0000000..9394739 Binary files /dev/null and b/da-DK/images/wordpress-welcome.png differ diff --git a/da-DK/images/wordpress_language.png b/da-DK/images/wordpress_language.png new file mode 100644 index 0000000..4d44ba3 Binary files /dev/null and b/da-DK/images/wordpress_language.png differ diff --git a/da-DK/images/wp-info.png b/da-DK/images/wp-info.png new file mode 100644 index 0000000..032e62e Binary files /dev/null and b/da-DK/images/wp-info.png differ diff --git a/da-DK/meta.yml b/da-DK/meta.yml new file mode 100644 index 0000000..b1fcdd6 --- /dev/null +++ b/da-DK/meta.yml @@ -0,0 +1,42 @@ +--- +title: Build a LAMP Web Server with WordPress +hero_image: images/banner.png +description: Set up a local server for a website on your Raspberry Pi +original_url: https://raspberrypi.org/learning/lamp-web-server-with-wordpress +theme: turquoise +duration: 2 +listed: true +ingredient: false +copyedit: false +curriculum: 3, design-0, programming-3, phys-comp-0, manufacture-0, community-0 +interests: '' +technologies: raspberry-pi, html-css-javascript +site_areas: projekter +hardware: raspberry-pi +software: html-css-javascript +version: 4 +last_tested: 2017/01/01 +steps: + - + title: Tillykke Med Fødselsdagen + - + title: Set up an Apache web server + completion: + - engaged + - + title: Install PHP + - + title: Install MariaDB + - + title: Download WordPress + - + title: Set up your WordPress database + completion: + - internal + - + title: WordPress configuration + completion: + - external + - + title: Challenge + challenge: true diff --git a/da-DK/step_1.md b/da-DK/step_1.md new file mode 100644 index 0000000..538b99d --- /dev/null +++ b/da-DK/step_1.md @@ -0,0 +1,12 @@ +## Hvad du vil lave +Learn to set up a LAMP (**L**inux, **A**pache, **M**ySQL, **P**HP) stack on your Raspberry Pi and configure it to work as a web server. + + - Install software on your Raspberry Pi + - Install and configure Apache, PHP, and MySQL to create a LAMP web server + - Download WordPress and run it as a local website on your Raspberry Pi + - Configure WordPress and make your website accessible to other devices on your local network + + +### You will need +- A Raspberry Pi computer connected to the internet +- [An up to date install of the Raspberry Pi OS](https://www.raspberrypi.org/downloads/) diff --git a/da-DK/step_2.md b/da-DK/step_2.md new file mode 100644 index 0000000..1cb6c47 --- /dev/null +++ b/da-DK/step_2.md @@ -0,0 +1,110 @@ +## Set up an Apache web server + +Apache is a popular web server application you can install on the Raspberry Pi to allow it to serve web pages. + +On its own, Apache can serve HTML files over HTTP. With additional modules it can serve dynamic web pages using scripting languages such as PHP. + +### Install Apache + +--- task --- + +Open a terminal window by selecting **Accessories** > **Terminal** from the menu. + +--- /task --- + +--- task --- + +Type the following command into the terminal and press Enter to install `apache2` + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo apt install apache2 -y + +--- /code --- + +**Tip:** If you see an error, make sure you are using the latest version of Raspberry Pi OS. + +--- /task --- + + +### Test the web server + +By default, Apache puts a test HTML file in the web folder that you will be able to view from your Pi or another computer on your network. + +--- task --- + +Open Chromium by selecting **Internet** > **Chromium Web Browser** from the menu. + +--- /task --- + +--- task --- + +Type `localhost` in the address bar. + +--- /task --- + +You should see this in your browser window: + +![Apache it works](images/apache-it-works.png) + +This means you have Apache working! + +### Changing the default web page + +This default web page is just a HTML file on the file system. It is located at `/var/www/html/index.html`. + +--- task --- + +Type the following command in the terminal to change to the directory containing the HTML file: + +--- code --- +--- +language: bash +line_numbers: false +--- +cd /var/www/html + +--- /code --- + +--- /task --- + +--- task --- + +Open the `index.html` file using Thonny + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo thonny index.html + +--- /code --- + +--- /task --- + +--- task --- + +Delete the contents of the file, then type a short message and save your changes. + +--- /task --- + +--- task --- + +Go back to Chromium and refresh the browser. You will see your message appear on the web page. + +--- /task --- + +--- collapse --- +--- +title: Access the page from another device on the network +--- + +You can open your web page from any other computer on your network, using the IP address of your Raspberry Pi, e.g. `http://192.168.1.10`. + +To find out your Raspberry Pi's IP address, type `hostname -I` into the terminal window. + +--- /collapse --- diff --git a/da-DK/step_3.md b/da-DK/step_3.md new file mode 100644 index 0000000..4bb6e7f --- /dev/null +++ b/da-DK/step_3.md @@ -0,0 +1,91 @@ +## Install PHP + +PHP is a **preprocessor**: it's code that runs when the server receives a request for a web page via a web browser. It works out what needs to be shown on the page, and then sends that page to the browser. + +--- task --- + +Type the following command in the terminal to install PHP: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo apt install php -y + +--- /code --- + +--- /task --- + +### Test PHP + +--- task --- + +Type this command to delete the `index.html` file from earlier: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo rm index.html + +--- /code --- + +--- /task --- + +--- task --- + +Create a new file called `index.php`: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo thonny index.php + +--- /code --- + +--- /task --- + +--- task --- + +In the Thonny code editor, type this PHP code into the file and save it. + +--- code --- +--- +language: php +line_numbers: false +--- + + +--- /code --- + +--- /task --- + +--- task --- + +Refresh your browser. You should see "hello world". This page is not dynamic, but it is still served by PHP. + +![hello world](images/apache-hello-world.png) + +--- /task --- + + +--- collapse --- +--- +title: I can only see PHP code +--- +If you see the raw PHP above instead of "hello world", use this command to reload and restart Apache: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo service apache2 restart + +--- /code --- + +--- /collapse --- diff --git a/da-DK/step_4.md b/da-DK/step_4.md new file mode 100644 index 0000000..cc6eae1 --- /dev/null +++ b/da-DK/step_4.md @@ -0,0 +1,75 @@ +## Install MariaDB + +MariaDB is a popular database engine. Like PHP, it's widely used on web servers, which is why projects like WordPress use it, and why those projects are so popular. + + +--- task --- + +Type this command to install the MariaDB Server and PHP-MySQL packages: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo apt install mariadb-server php-mysql -y + +--- /code --- + +--- /task --- + +--- task --- + +Now restart Apache: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo service apache2 restart + +--- /code --- + +--- /task --- + +### Set up + +--- task --- + +Run the MySQL secure installation command in the terminal window. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo mysql_secure_installation + +--- /code --- + +--- /task --- + +--- task --- + +Go through the setup wizard using the following answers: + ++ `Enter current password for root (enter for none):` — press **Enter**. + ++ `Switch to unix_socket authentication [Y/n]` - Type in **N** and press **Enter** + ++ `Change the root password?` - Type in **Y** and press **Enter** + ++ `New password:` - Type in a password and press **Enter**, then repeat a second time. **Important:** remember this root password, as you will need it later to set up WordPress. + ++ `Remove anonymous users` - Type in **Y** + ++ `Disallow root login remotely` - Type in **Y** + ++ `Remove test database and access to it` - Type in **Y** + ++ `Reload privilege tables now` - Type in **Y** + +--- /task --- + +When complete, you will see the message `All done!` and `Thanks for using MariaDB!`. diff --git a/da-DK/step_5.md b/da-DK/step_5.md new file mode 100644 index 0000000..d34db90 --- /dev/null +++ b/da-DK/step_5.md @@ -0,0 +1,109 @@ +## Download WordPress + +WordPress is a popular tool used to quickly create a website or blog with an easy to use editor for creating new content. + + +--- task --- + +In your terminal, make sure you are still in the directory `/var/www/html/` + +--- code --- +--- +language: bash +line_numbers: false +--- +cd /var/www/html/ + +--- /code --- + +--- /task --- + +--- task --- + +Delete all the files in the folder. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo rm * + +--- /code --- + +--- /task --- + +--- task --- + +Type this command to download WordPress + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo wget http://wordpress.org/latest.tar.gz + +--- /code --- + +--- /task --- + +--- task --- + +Extract the WordPress software: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo tar xzf latest.tar.gz + +--- /code --- + +--- /task --- + +--- task --- + +Move the contents of the extracted `wordpress` directory to the current directory. **Tip:** Make sure you type the whole command including the dot. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo mv wordpress/* . + +--- /code --- + +--- /task --- + +--- task --- + +Tidy up by removing the download, and the now empty `wordpress` directory. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo rm -rf wordpress latest.tar.gz + +--- /code --- + +--- /task --- + +---task --- + +Change the ownership of all these files to the Apache user: **Tip:** Make sure you type the whole command including the dot. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo chown -R www-data: . + +--- /code --- + +--- /task --- diff --git a/da-DK/step_6.md b/da-DK/step_6.md new file mode 100644 index 0000000..eefa5ec --- /dev/null +++ b/da-DK/step_6.md @@ -0,0 +1,95 @@ +## Set up your WordPress Database + +--- task --- + +Run `mysql` in the terminal window: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo mysql -uroot -p + +--- /code --- + +--- /task --- + +--- task --- + +Enter the root password you created when you set up the database. + +You will see the message `Welcome to the MariaDB monitor` and then the `MariaDB [(none)]>` prompt. + +--- /task --- + +--- task --- + +At the `MariaDB [(none)]>` prompt, type: **Tip:** Don't forget to type the semicolon at the end. + +--- code --- +--- +language: sql +line_numbers: false +--- +create database wordpress; + +--- /code --- + + + +--- /task --- + +If this has been successful, you should see `Query OK, 1 row affected (0.00 sec)`. + +--- task --- + +At the MariaDB prompt, grant database privileges to the root user. Change `YOURPASSWORD` to the password you created before. + +--- code --- +--- +language: sql +line_numbers: false +--- + +GRANT ALL PRIVILEGES ON wordpress.* TO 'root'@'localhost' IDENTIFIED BY 'YOURPASSWORD'; + +--- /code --- + +--- /task --- + +--- task --- + +For the changes to take effect, you will need to flush the database privileges: + +--- code --- +--- +language: sql +line_numbers: false +--- +FLUSH PRIVILEGES; + +--- /code --- + +--- /task --- + +--- task --- + +Exit the MariaDB prompt with Ctrl + D. + +--- /task --- + +--- task --- + +Restart your Raspberry Pi by typing this command in the terminal: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo reboot + +--- /code --- + +--- /task --- diff --git a/da-DK/step_7.md b/da-DK/step_7.md new file mode 100644 index 0000000..be18128 --- /dev/null +++ b/da-DK/step_7.md @@ -0,0 +1,155 @@ +## WordPress configuration + +--- task --- + +Once your Raspberry Pi has rebooted, open Chromium and type `localhost` into the address bar. + +You should see a WordPress page asking to pick your language. + +![WordPress select language](images/wordpress_language.png) + +--- /task --- + +--- task --- + +Select your language and click **Continue**. + +--- /task --- + +You will be presented with the WordPress welcome screen. + +![WordPress welcome screen](images/wordpress-welcome.png) + +--- task --- + +Click the **Let's go!** button. + +--- /task --- + +--- task --- + +Now fill out the basic site information as follows: **Tip:** Make sure you type `wordpress` in the first box as the text displayed is only a suggestion, the box is blank. + +``` +Database Name: wordpress +User Name: root +Password: +Database Host: localhost +Table Prefix: wp_ +``` + +Click **Submit** to proceed. + +--- /task --- + + +--- task --- + +Click the **Run the install** button. + +--- /task --- + +--- task --- + +Fill in the information you are asked for, then click the `Install WordPress` button. + +--- /task --- + +--- task --- + +Log in, using the account you just created. + +Now you're logged in and have your site set up, you can see the website by visiting your `http://localhost/wp-admin`. + +--- /task --- + + +### Friendly permalinks + +It's recommended that you change your permalink settings to make your URLs more friendly. + +--- task --- + +Log in to WordPress and go to the dashboard. + +--- /task --- + +--- task --- + +Go to **Setting**, then **Permalinks**. + +--- /task --- + +--- task --- + +Select the **Post name** option and click **Save Changes**. + +--- /task --- + +--- task --- + +Type the following command in a terminal to enable Apache's `rewrite` mod: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo a2enmod rewrite + +--- /code --- + +--- /task --- + +--- task --- + +Open the Apache configuration file + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo geany /etc/apache2/sites-available/000-default.conf + +--- /code --- + +--- /task --- + +--- task --- + +Add the following lines after line 1. + +--- code --- +--- +language: sql line_numbers: true line_number_start: 2 +line_highlights: 3-5 +--- + AllowOverride All + +--- /code --- + +--- /task --- + +--- task --- + +Save the file and close Geany. + +--- /task --- + +--- task --- + +In a terminal type the command to restart Apache: + + + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo service apache2 restart + +--- /code --- + +--- /task --- \ No newline at end of file diff --git a/da-DK/step_8.md b/da-DK/step_8.md new file mode 100644 index 0000000..2e023a0 --- /dev/null +++ b/da-DK/step_8.md @@ -0,0 +1,17 @@ +## Challenge + +--- challenge --- + +--- task --- + +Add more pages to your website. + +--- /task --- + +--- task --- + +Install a different theme from the Appearance menu. + +--- /task --- + +--- /challenge --- diff --git a/da-DK/step_9.md b/da-DK/step_9.md new file mode 100644 index 0000000..fc5847a --- /dev/null +++ b/da-DK/step_9.md @@ -0,0 +1,3 @@ +## What can you do now? + +You could try setting up a [Python web server with Flask](https://projects.raspberrypi.org/en/projects/python-web-server-with-flask) \ No newline at end of file diff --git a/de-DE/images/Python-Webserver-with-Wordpress-TILE-01.png b/de-DE/images/Python-Webserver-with-Wordpress-TILE-01.png new file mode 100644 index 0000000..f632634 Binary files /dev/null and b/de-DE/images/Python-Webserver-with-Wordpress-TILE-01.png differ diff --git a/de-DE/images/Python-Webserver-with-Wordpress.png b/de-DE/images/Python-Webserver-with-Wordpress.png new file mode 100644 index 0000000..07b0191 Binary files /dev/null and b/de-DE/images/Python-Webserver-with-Wordpress.png differ diff --git a/de-DE/images/apache-hello-world.png b/de-DE/images/apache-hello-world.png new file mode 100644 index 0000000..97ad925 Binary files /dev/null and b/de-DE/images/apache-hello-world.png differ diff --git a/de-DE/images/apache-it-works.png b/de-DE/images/apache-it-works.png new file mode 100644 index 0000000..fb71d9f Binary files /dev/null and b/de-DE/images/apache-it-works.png differ diff --git a/de-DE/images/banner.png b/de-DE/images/banner.png new file mode 100644 index 0000000..88a7bfb Binary files /dev/null and b/de-DE/images/banner.png differ diff --git a/de-DE/images/create-database.png b/de-DE/images/create-database.png new file mode 100644 index 0000000..951c4b2 Binary files /dev/null and b/de-DE/images/create-database.png differ diff --git a/de-DE/images/hostname.png b/de-DE/images/hostname.png new file mode 100644 index 0000000..bb50249 Binary files /dev/null and b/de-DE/images/hostname.png differ diff --git a/de-DE/images/hostname_annotated.png b/de-DE/images/hostname_annotated.png new file mode 100644 index 0000000..27b2f08 Binary files /dev/null and b/de-DE/images/hostname_annotated.png differ diff --git a/de-DE/images/install_apache.png b/de-DE/images/install_apache.png new file mode 100644 index 0000000..c826f4f Binary files /dev/null and b/de-DE/images/install_apache.png differ diff --git a/de-DE/images/wordpress-database-setup.png b/de-DE/images/wordpress-database-setup.png new file mode 100644 index 0000000..970373c Binary files /dev/null and b/de-DE/images/wordpress-database-setup.png differ diff --git a/de-DE/images/wordpress-information_needed.png b/de-DE/images/wordpress-information_needed.png new file mode 100644 index 0000000..8119d0a Binary files /dev/null and b/de-DE/images/wordpress-information_needed.png differ diff --git a/de-DE/images/wordpress-run-installation.png b/de-DE/images/wordpress-run-installation.png new file mode 100644 index 0000000..ce44b71 Binary files /dev/null and b/de-DE/images/wordpress-run-installation.png differ diff --git a/de-DE/images/wordpress-welcome.png b/de-DE/images/wordpress-welcome.png new file mode 100644 index 0000000..9d955f1 Binary files /dev/null and b/de-DE/images/wordpress-welcome.png differ diff --git a/de-DE/images/wordpress_language.png b/de-DE/images/wordpress_language.png new file mode 100644 index 0000000..4d44ba3 Binary files /dev/null and b/de-DE/images/wordpress_language.png differ diff --git a/de-DE/images/wp-info.png b/de-DE/images/wp-info.png new file mode 100644 index 0000000..0f77011 Binary files /dev/null and b/de-DE/images/wp-info.png differ diff --git a/de-DE/meta.yml b/de-DE/meta.yml new file mode 100644 index 0000000..cc44c10 --- /dev/null +++ b/de-DE/meta.yml @@ -0,0 +1,42 @@ +--- +title: Einen LAMP-Webserver mit WordPress erstellen +hero_image: images/banner.png +description: Richte auf deinem Raspberry Pi einen lokalen Server für eine Website ein +original_url: https://raspberrypi.org/learning/lamp-web-server-with-wordpress +theme: turquoise +duration: 2 +listed: true +ingredient: false +copyedit: false +curriculum: 3, design-0, programming-3, phys-comp-0, manufacture-0, community-0 +interests: '' +technologies: raspberry-pi, html-css-javascript +site_areas: projects +hardware: Raspberry Pi +software: html-css-javascript +version: 4 +last_tested: 2017-01-01 +steps: + - + title: Einleitung + - + title: Was du brauchen wirst + completion: + - engaged + - + title: Richte einen Apache Webserver ein + - + title: Installiere PHP + - + title: Installiere MySQL + - + title: Lade WordPress herunter + completion: + - internal + - + title: Richte deine WordPress Datenbank ein + completion: + - external + - + title: WordPress Einstellungen + challenge: true diff --git a/de-DE/step_1.md b/de-DE/step_1.md new file mode 100644 index 0000000..766a54c --- /dev/null +++ b/de-DE/step_1.md @@ -0,0 +1,12 @@ +## Was du machen wirst +Lerne wie du einen LAMP-Stack (**L**inux, **A**pache, **M**ySQL, **P**HP) auf deinem Raspberry Pi aufsetzt und so konfigurierst, dass er als Webserver arbeitet. + + - Software auf deinem Raspberry Pi installierst + - Apache, PHP und MySQL installierst und konfigurierst um einen LAMP-Webserver zu erstellen + - WordPress herunterlädst und als lokale Website auf deinem Raspberry Pi laufen lässt + - WordPress konfigurierst und deine Website anderen Geräten in deinem lokalen Netzwerk zugänglich machst + + +### You will need +- A Raspberry Pi computer connected to the internet +- [An up to date install of the Raspberry Pi OS](https://www.raspberrypi.org/downloads/) diff --git a/de-DE/step_2.md b/de-DE/step_2.md new file mode 100644 index 0000000..1cb6c47 --- /dev/null +++ b/de-DE/step_2.md @@ -0,0 +1,110 @@ +## Set up an Apache web server + +Apache is a popular web server application you can install on the Raspberry Pi to allow it to serve web pages. + +On its own, Apache can serve HTML files over HTTP. With additional modules it can serve dynamic web pages using scripting languages such as PHP. + +### Install Apache + +--- task --- + +Open a terminal window by selecting **Accessories** > **Terminal** from the menu. + +--- /task --- + +--- task --- + +Type the following command into the terminal and press Enter to install `apache2` + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo apt install apache2 -y + +--- /code --- + +**Tip:** If you see an error, make sure you are using the latest version of Raspberry Pi OS. + +--- /task --- + + +### Test the web server + +By default, Apache puts a test HTML file in the web folder that you will be able to view from your Pi or another computer on your network. + +--- task --- + +Open Chromium by selecting **Internet** > **Chromium Web Browser** from the menu. + +--- /task --- + +--- task --- + +Type `localhost` in the address bar. + +--- /task --- + +You should see this in your browser window: + +![Apache it works](images/apache-it-works.png) + +This means you have Apache working! + +### Changing the default web page + +This default web page is just a HTML file on the file system. It is located at `/var/www/html/index.html`. + +--- task --- + +Type the following command in the terminal to change to the directory containing the HTML file: + +--- code --- +--- +language: bash +line_numbers: false +--- +cd /var/www/html + +--- /code --- + +--- /task --- + +--- task --- + +Open the `index.html` file using Thonny + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo thonny index.html + +--- /code --- + +--- /task --- + +--- task --- + +Delete the contents of the file, then type a short message and save your changes. + +--- /task --- + +--- task --- + +Go back to Chromium and refresh the browser. You will see your message appear on the web page. + +--- /task --- + +--- collapse --- +--- +title: Access the page from another device on the network +--- + +You can open your web page from any other computer on your network, using the IP address of your Raspberry Pi, e.g. `http://192.168.1.10`. + +To find out your Raspberry Pi's IP address, type `hostname -I` into the terminal window. + +--- /collapse --- diff --git a/de-DE/step_3.md b/de-DE/step_3.md new file mode 100644 index 0000000..abbe14e --- /dev/null +++ b/de-DE/step_3.md @@ -0,0 +1,91 @@ +## Apache installieren + +PHP is a **preprocessor**: it's code that runs when the server receives a request for a web page via a web browser. It works out what needs to be shown on the page, and then sends that page to the browser. + +--- task --- + +Type the following command in the terminal to install PHP: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo apt install php -y + +--- /code --- + +--- /task --- + +### Test PHP + +--- task --- + +Type this command to delete the `index.html` file from earlier: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo rm index.html + +--- /code --- + +--- /task --- + +--- task --- + +Create a new file called `index.php`: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo thonny index.php + +--- /code --- + +--- /task --- + +--- task --- + +In the Thonny code editor, type this PHP code into the file and save it. + +--- code --- +--- +language: php +line_numbers: false +--- + + +--- /code --- + +--- /task --- + +--- task --- + +Refresh your browser. You should see "hello world". This page is not dynamic, but it is still served by PHP. + +![hello world](images/apache-hello-world.png) + +--- /task --- + + +--- collapse --- +--- +title: I can only see PHP code +--- +If you see the raw PHP above instead of "hello world", use this command to reload and restart Apache: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo service apache2 restart + +--- /code --- + +--- /collapse --- diff --git a/de-DE/step_4.md b/de-DE/step_4.md new file mode 100644 index 0000000..f8a0527 --- /dev/null +++ b/de-DE/step_4.md @@ -0,0 +1,75 @@ +## Install MariaDB + +MariaDB is a popular database engine. PHP ist eine sehr beliebte Sprache im Web: Große Projekte wie Facebook und Wikipedia sind in PHP geschrieben. + + +--- task --- + +Installiere das PHP-Paket mit dem folgenden Befehl: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo apt-get install php -y + +--- /code --- + +--- /task --- + +--- task --- + +Now restart Apache: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo service apache2 restart + +--- /code --- + +--- /task --- + +### Set up + +--- task --- + +Run the MySQL secure installation command in the terminal window. + +--- code --- +--- +language: bash +line_numbers: false +--- +Installiere PHP + +--- /code --- + +--- /task --- + +--- task --- + +Go through the setup wizard using the following answers: + ++ `Enter current password for root (enter for none):` — press **Enter**. + ++ `Switch to unix_socket authentication [Y/n]` - Type in **N** and press **Enter** + ++ `Change the root password?` - Type in **Y** and press **Enter** + ++ `New password:` - Type in a password and press **Enter**, then repeat a second time. **Important:** remember this root password, as you will need it later to set up WordPress. + ++ `Remove anonymous users` - Type in **Y** + ++ `Disallow root login remotely` - Type in **Y** + ++ `Remove test database and access to it` - Type in **Y** + ++ `Reload privilege tables now` - Type in **Y** + +--- /task --- + +When complete, you will see the message `All done!` and `Thanks for using MariaDB!`. diff --git a/de-DE/step_5.md b/de-DE/step_5.md new file mode 100644 index 0000000..df8ff43 --- /dev/null +++ b/de-DE/step_5.md @@ -0,0 +1,109 @@ +## Download WordPress + +WordPress is a popular tool used to quickly create a website or blog with an easy to use editor for creating new content. + + +--- task --- + +In your terminal, make sure you are still in the directory `/var/www/html/` + +--- code --- +--- +language: bash +line_numbers: false +--- +cd /var/www/html/ + +--- /code --- + +--- /task --- + +--- task --- + +Delete all the files in the folder. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo rm * + +--- /code --- + +--- /task --- + +--- task --- + +Type this command to download WordPress + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo wget http://wordpress.org/latest.tar.gz + +--- /code --- + +--- /task --- + +--- task --- + +Extract the WordPress software: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo tar xzf latest.tar.gz + +--- /code --- + +--- /task --- + +--- task --- + +Move the contents of the extracted `wordpress` directory to the current directory. **Tip:** Make sure you type the whole command including the dot. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo mv wordpress/* . + +--- /code --- + +--- /task --- + +--- task --- + +Tidy up by removing the download, and the now empty `wordpress` directory. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo service apache2 restart + +--- /code --- + +--- /task --- + +---task --- + +Change the ownership of all these files to the Apache user: **Tip:** Make sure you type the whole command including the dot. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo chown -R www-data: . + +--- /code --- + +--- /task --- diff --git a/de-DE/step_6.md b/de-DE/step_6.md new file mode 100644 index 0000000..f92034e --- /dev/null +++ b/de-DE/step_6.md @@ -0,0 +1,95 @@ +## Set up your WordPress Database + +title: Was ist eine .tar.gz Datei? + +Run `mysql` in the terminal window: + +Lade WordPress herunter +--- +language: bash +line_numbers: false +--- +sudo rm -rf wordpress latest.tar.gz + +sudo mv wordpress/* . + +--- /task --- + +--- collapse --- + +Enter the root password you created when you set up the database. + +You will see the message `Welcome to the MariaDB monitor` and then the `MariaDB [(none)]>` prompt. + +--- /collapse --- + +--- task --- + +At the `MariaDB [(none)]>` prompt, type: **Tip:** Don't forget to type the semicolon at the end. + +Extrahiere den WordPress-Tarball um an die WordPress-Dateien zu gelangen. +--- +language: sql +line_numbers: false +--- +create database wordpress; + +Wechsel ins Verzeichnis `/var/www/html/` und lösche alle Dateien im Verzeichnis. + + + +--- /task --- + +If this has been successful, you should see `Query OK, 1 row affected (0.00 sec)`. + +--- task --- + +At the MariaDB prompt, grant database privileges to the root user. Change `YOURPASSWORD` to the password you created before. + +Verschiebe den Inhalt des entpackten `wordpress` Verzeichnisses in das aktuelle Verzeichnis. +--- +language: sql +line_numbers: false +--- + +GRANT ALL PRIVILEGES ON wordpress.* TO 'root'@'localhost' IDENTIFIED BY 'YOURPASSWORD'; + +Lade WordPress mit `wget` herunter. + +--- /collapse --- + +Du solltest jetzt den Besitzer all dieser Datein auf den Apache-Benutzer ändern: + +For the changes to take effect, you will need to flush the database privileges: + +Räum auf, indem du den Tarball und das, nun leere, `wordpress` Verzeichnis löscht. +--- +language: sql +line_numbers: false +--- +FLUSH PRIVILEGES; + +sudo chown -R www-data: . + +--- /task --- + +sudo wget http://wordpress.org/latest.tar.gz + +Exit the MariaDB prompt with Ctrl + D. + +--- /task --- + +--- task --- + +Restart your Raspberry Pi by typing this command in the terminal: + +Wenn du jetzt den `ls` oder `tree -L 1` Befehl ausführst, wird der Inhalt des WordPress-Projekts angezeigt: +--- +language: bash +line_numbers: false +--- +sudo tar xzf latest.tar.gz + +cd /var/www/html/ sudo rm * + +--- /task --- diff --git a/de-DE/step_7.md b/de-DE/step_7.md new file mode 100644 index 0000000..cab38ef --- /dev/null +++ b/de-DE/step_7.md @@ -0,0 +1,155 @@ +## Richte deine WordPress Datenbank ein + +--- task --- + +Once your Raspberry Pi has rebooted, open Chromium and type `localhost` into the address bar. + +You should see a WordPress page asking to pick your language. + +![WordPress select language](images/wordpress_language.png) + +--- /task --- + +--- task --- + +Select your language and click **Continue**. + +--- /task --- + +You will be presented with the WordPress welcome screen. + +![WordPress welcome screen](images/wordpress-welcome.png) + +--- task --- + +Gib **Y** ein, um den Anonymen-Benutzer zu entfernen (`Remove anonymous users`). + +--- /task --- + +--- task --- + +Now fill out the basic site information as follows: **Tip:** Make sure you type `wordpress` in the first box as the text displayed is only a suggestion, the box is blank. + +``` +Database Name: wordpress +User Name: root +Password: +Database Host: localhost +Table Prefix: wp_ +``` + +**Hinweis:** Nach `IDENTIFIED BY` musst du dein eigenes Passwort eingeben. + +--- /task --- + + +--- task --- + +Click the **Run the install** button. + +--- /task --- + +--- task --- + +Fill in the information you are asked for, then click the `Install WordPress` button. + +--- /task --- + +--- task --- + +Log in, using the account you just created. + +Now you're logged in and have your site set up, you can see the website by visiting your `http://localhost/wp-admin`. + +--- /task --- + + +### Friendly permalinks + +It's recommended that you change your permalink settings to make your URLs more friendly. + +--- task --- + +Log in to WordPress and go to the dashboard. + +--- /task --- + +--- task --- + +Gib **Y** (für Yes, also Ja) ein und drücke **Enter**, um das root-Passwort zu setzen (`Set root password?`). + +--- /task --- + +--- task --- + +Select the **Post name** option and click **Save Changes**. + +--- /task --- + +--- task --- + +Type the following command in a terminal to enable Apache's `rewrite` mod: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo a2enmod rewrite + +--- /code --- + +--- /task --- + +--- task --- + +Open the Apache configuration file + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo geany /etc/apache2/sites-available/000-default.conf + +--- /code --- + +--- /task --- + +--- task --- + +Add the following lines after line 1. + +--- code --- +--- +language: sql line_numbers: true line_number_start: 2 +line_highlights: 3-5 +--- + AllowOverride All + +--- /code --- + +--- /task --- + +--- task --- + +Save the file and close Geany. + +--- /task --- + +--- task --- + +In a terminal type the command to restart Apache: + + + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo service apache2 restart + +--- /code --- + +--- /task --- \ No newline at end of file diff --git a/de-DE/step_8.md b/de-DE/step_8.md new file mode 100644 index 0000000..9061e0d --- /dev/null +++ b/de-DE/step_8.md @@ -0,0 +1,17 @@ +## Challenge + +--- /collapse --- + +images/wp-info.png + +Add more pages to your website. + +images/wordpress-welcome.png + +hostname -I + +Install a different theme from the Appearance menu. + +images/wordpress_language.png + +--- collapse --- diff --git a/de-DE/step_9.md b/de-DE/step_9.md new file mode 100644 index 0000000..fc5847a --- /dev/null +++ b/de-DE/step_9.md @@ -0,0 +1,3 @@ +## What can you do now? + +You could try setting up a [Python web server with Flask](https://projects.raspberrypi.org/en/projects/python-web-server-with-flask) \ No newline at end of file diff --git a/el-GR/images/Python-Webserver-with-Wordpress-TILE-01.png b/el-GR/images/Python-Webserver-with-Wordpress-TILE-01.png new file mode 100644 index 0000000..f632634 Binary files /dev/null and b/el-GR/images/Python-Webserver-with-Wordpress-TILE-01.png differ diff --git a/el-GR/images/Python-Webserver-with-Wordpress.png b/el-GR/images/Python-Webserver-with-Wordpress.png new file mode 100644 index 0000000..07b0191 Binary files /dev/null and b/el-GR/images/Python-Webserver-with-Wordpress.png differ diff --git a/el-GR/images/apache-hello-world.png b/el-GR/images/apache-hello-world.png new file mode 100644 index 0000000..69fb339 Binary files /dev/null and b/el-GR/images/apache-hello-world.png differ diff --git a/el-GR/images/apache-it-works.png b/el-GR/images/apache-it-works.png new file mode 100644 index 0000000..fb71d9f Binary files /dev/null and b/el-GR/images/apache-it-works.png differ diff --git a/el-GR/images/banner.png b/el-GR/images/banner.png new file mode 100644 index 0000000..88a7bfb Binary files /dev/null and b/el-GR/images/banner.png differ diff --git a/el-GR/images/create-database.png b/el-GR/images/create-database.png new file mode 100644 index 0000000..7ed1a65 Binary files /dev/null and b/el-GR/images/create-database.png differ diff --git a/el-GR/images/hostname.png b/el-GR/images/hostname.png new file mode 100644 index 0000000..bb50249 Binary files /dev/null and b/el-GR/images/hostname.png differ diff --git a/el-GR/images/hostname_annotated.png b/el-GR/images/hostname_annotated.png new file mode 100644 index 0000000..27b2f08 Binary files /dev/null and b/el-GR/images/hostname_annotated.png differ diff --git a/el-GR/images/install_apache.png b/el-GR/images/install_apache.png new file mode 100644 index 0000000..d273ecd Binary files /dev/null and b/el-GR/images/install_apache.png differ diff --git a/el-GR/images/wordpress-database-setup.png b/el-GR/images/wordpress-database-setup.png new file mode 100644 index 0000000..6375121 Binary files /dev/null and b/el-GR/images/wordpress-database-setup.png differ diff --git a/el-GR/images/wordpress-information_needed.png b/el-GR/images/wordpress-information_needed.png new file mode 100644 index 0000000..69f5cc3 Binary files /dev/null and b/el-GR/images/wordpress-information_needed.png differ diff --git a/el-GR/images/wordpress-run-installation.png b/el-GR/images/wordpress-run-installation.png new file mode 100644 index 0000000..a519df5 Binary files /dev/null and b/el-GR/images/wordpress-run-installation.png differ diff --git a/el-GR/images/wordpress-welcome.png b/el-GR/images/wordpress-welcome.png new file mode 100644 index 0000000..eaf43a7 Binary files /dev/null and b/el-GR/images/wordpress-welcome.png differ diff --git a/el-GR/images/wordpress_language.png b/el-GR/images/wordpress_language.png new file mode 100644 index 0000000..c1d7c05 Binary files /dev/null and b/el-GR/images/wordpress_language.png differ diff --git a/el-GR/images/wp-info.png b/el-GR/images/wp-info.png new file mode 100644 index 0000000..d9f3427 Binary files /dev/null and b/el-GR/images/wp-info.png differ diff --git a/el-GR/meta.yml b/el-GR/meta.yml new file mode 100644 index 0000000..57b831b --- /dev/null +++ b/el-GR/meta.yml @@ -0,0 +1,42 @@ +--- +title: Δημιούργησε έναν Διακομιστή Ιστού LAMP με WordPress +hero_image: images/banner.png +description: Ρύθμισε έναν τοπικό διακομιστή για έναν ιστότοπο στο Raspberry Pi +original_url: https://raspberrypi.org/learning/lamp-web-server-with-wordpress +theme: turquoise +duration: 2 +listed: true +ingredient: false +copyedit: false +curriculum: 3, design-0, programming-3, phys-comp-0, manufacture-0, community-0 +interests: '' +technologies: raspberry-pi, html-css-javascript +site_areas: projects +hardware: raspberry-pi +software: html-css-javascript +version: 4 +last_tested: 2017-01-01 +steps: + - + title: Εισαγωγή + - + title: Set up an Apache web server + completion: + - engaged + - + title: Install PHP + - + title: Install MariaDB + - + title: Download WordPress + - + title: Set up your WordPress database + completion: + - internal + - + title: WordPress configuration + completion: + - external + - + title: Challenge + challenge: true diff --git a/el-GR/step_1.md b/el-GR/step_1.md new file mode 100644 index 0000000..7b40225 --- /dev/null +++ b/el-GR/step_1.md @@ -0,0 +1,12 @@ +## Τι θα φτιάξεις +Learn to set up a LAMP (**L**inux, **A**pache, **M**ySQL, **P**HP) stack on your Raspberry Pi and configure it to work as a web server. + + - Εγκαταστήσεις λογισμικό στο Raspberry Pi + - Εγκαταστήσεις και να ρυθμίσεις τα Apache, PHP και MySQL για να δημιουργήσεις έναν διακομιστή ιστού LAMP + - Κάνεις λήψη του WordPress και να το εκτελείς ως τοπικό ιστότοπο στο Raspberry Pi + - Διαμορφώσεις το WordPress και να κάνεις τον ιστότοπό σου προσβάσιμο από άλλες συσκευές στο τοπικό σου δίκτυο + + +### You will need +- A Raspberry Pi computer connected to the internet +- [An up to date install of the Raspberry Pi OS](https://www.raspberrypi.org/downloads/) diff --git a/el-GR/step_2.md b/el-GR/step_2.md new file mode 100644 index 0000000..1cb6c47 --- /dev/null +++ b/el-GR/step_2.md @@ -0,0 +1,110 @@ +## Set up an Apache web server + +Apache is a popular web server application you can install on the Raspberry Pi to allow it to serve web pages. + +On its own, Apache can serve HTML files over HTTP. With additional modules it can serve dynamic web pages using scripting languages such as PHP. + +### Install Apache + +--- task --- + +Open a terminal window by selecting **Accessories** > **Terminal** from the menu. + +--- /task --- + +--- task --- + +Type the following command into the terminal and press Enter to install `apache2` + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo apt install apache2 -y + +--- /code --- + +**Tip:** If you see an error, make sure you are using the latest version of Raspberry Pi OS. + +--- /task --- + + +### Test the web server + +By default, Apache puts a test HTML file in the web folder that you will be able to view from your Pi or another computer on your network. + +--- task --- + +Open Chromium by selecting **Internet** > **Chromium Web Browser** from the menu. + +--- /task --- + +--- task --- + +Type `localhost` in the address bar. + +--- /task --- + +You should see this in your browser window: + +![Apache it works](images/apache-it-works.png) + +This means you have Apache working! + +### Changing the default web page + +This default web page is just a HTML file on the file system. It is located at `/var/www/html/index.html`. + +--- task --- + +Type the following command in the terminal to change to the directory containing the HTML file: + +--- code --- +--- +language: bash +line_numbers: false +--- +cd /var/www/html + +--- /code --- + +--- /task --- + +--- task --- + +Open the `index.html` file using Thonny + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo thonny index.html + +--- /code --- + +--- /task --- + +--- task --- + +Delete the contents of the file, then type a short message and save your changes. + +--- /task --- + +--- task --- + +Go back to Chromium and refresh the browser. You will see your message appear on the web page. + +--- /task --- + +--- collapse --- +--- +title: Access the page from another device on the network +--- + +You can open your web page from any other computer on your network, using the IP address of your Raspberry Pi, e.g. `http://192.168.1.10`. + +To find out your Raspberry Pi's IP address, type `hostname -I` into the terminal window. + +--- /collapse --- diff --git a/el-GR/step_3.md b/el-GR/step_3.md new file mode 100644 index 0000000..4bb6e7f --- /dev/null +++ b/el-GR/step_3.md @@ -0,0 +1,91 @@ +## Install PHP + +PHP is a **preprocessor**: it's code that runs when the server receives a request for a web page via a web browser. It works out what needs to be shown on the page, and then sends that page to the browser. + +--- task --- + +Type the following command in the terminal to install PHP: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo apt install php -y + +--- /code --- + +--- /task --- + +### Test PHP + +--- task --- + +Type this command to delete the `index.html` file from earlier: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo rm index.html + +--- /code --- + +--- /task --- + +--- task --- + +Create a new file called `index.php`: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo thonny index.php + +--- /code --- + +--- /task --- + +--- task --- + +In the Thonny code editor, type this PHP code into the file and save it. + +--- code --- +--- +language: php +line_numbers: false +--- + + +--- /code --- + +--- /task --- + +--- task --- + +Refresh your browser. You should see "hello world". This page is not dynamic, but it is still served by PHP. + +![hello world](images/apache-hello-world.png) + +--- /task --- + + +--- collapse --- +--- +title: I can only see PHP code +--- +If you see the raw PHP above instead of "hello world", use this command to reload and restart Apache: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo service apache2 restart + +--- /code --- + +--- /collapse --- diff --git a/el-GR/step_4.md b/el-GR/step_4.md new file mode 100644 index 0000000..cc6eae1 --- /dev/null +++ b/el-GR/step_4.md @@ -0,0 +1,75 @@ +## Install MariaDB + +MariaDB is a popular database engine. Like PHP, it's widely used on web servers, which is why projects like WordPress use it, and why those projects are so popular. + + +--- task --- + +Type this command to install the MariaDB Server and PHP-MySQL packages: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo apt install mariadb-server php-mysql -y + +--- /code --- + +--- /task --- + +--- task --- + +Now restart Apache: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo service apache2 restart + +--- /code --- + +--- /task --- + +### Set up + +--- task --- + +Run the MySQL secure installation command in the terminal window. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo mysql_secure_installation + +--- /code --- + +--- /task --- + +--- task --- + +Go through the setup wizard using the following answers: + ++ `Enter current password for root (enter for none):` — press **Enter**. + ++ `Switch to unix_socket authentication [Y/n]` - Type in **N** and press **Enter** + ++ `Change the root password?` - Type in **Y** and press **Enter** + ++ `New password:` - Type in a password and press **Enter**, then repeat a second time. **Important:** remember this root password, as you will need it later to set up WordPress. + ++ `Remove anonymous users` - Type in **Y** + ++ `Disallow root login remotely` - Type in **Y** + ++ `Remove test database and access to it` - Type in **Y** + ++ `Reload privilege tables now` - Type in **Y** + +--- /task --- + +When complete, you will see the message `All done!` and `Thanks for using MariaDB!`. diff --git a/el-GR/step_5.md b/el-GR/step_5.md new file mode 100644 index 0000000..d34db90 --- /dev/null +++ b/el-GR/step_5.md @@ -0,0 +1,109 @@ +## Download WordPress + +WordPress is a popular tool used to quickly create a website or blog with an easy to use editor for creating new content. + + +--- task --- + +In your terminal, make sure you are still in the directory `/var/www/html/` + +--- code --- +--- +language: bash +line_numbers: false +--- +cd /var/www/html/ + +--- /code --- + +--- /task --- + +--- task --- + +Delete all the files in the folder. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo rm * + +--- /code --- + +--- /task --- + +--- task --- + +Type this command to download WordPress + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo wget http://wordpress.org/latest.tar.gz + +--- /code --- + +--- /task --- + +--- task --- + +Extract the WordPress software: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo tar xzf latest.tar.gz + +--- /code --- + +--- /task --- + +--- task --- + +Move the contents of the extracted `wordpress` directory to the current directory. **Tip:** Make sure you type the whole command including the dot. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo mv wordpress/* . + +--- /code --- + +--- /task --- + +--- task --- + +Tidy up by removing the download, and the now empty `wordpress` directory. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo rm -rf wordpress latest.tar.gz + +--- /code --- + +--- /task --- + +---task --- + +Change the ownership of all these files to the Apache user: **Tip:** Make sure you type the whole command including the dot. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo chown -R www-data: . + +--- /code --- + +--- /task --- diff --git a/el-GR/step_6.md b/el-GR/step_6.md new file mode 100644 index 0000000..eefa5ec --- /dev/null +++ b/el-GR/step_6.md @@ -0,0 +1,95 @@ +## Set up your WordPress Database + +--- task --- + +Run `mysql` in the terminal window: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo mysql -uroot -p + +--- /code --- + +--- /task --- + +--- task --- + +Enter the root password you created when you set up the database. + +You will see the message `Welcome to the MariaDB monitor` and then the `MariaDB [(none)]>` prompt. + +--- /task --- + +--- task --- + +At the `MariaDB [(none)]>` prompt, type: **Tip:** Don't forget to type the semicolon at the end. + +--- code --- +--- +language: sql +line_numbers: false +--- +create database wordpress; + +--- /code --- + + + +--- /task --- + +If this has been successful, you should see `Query OK, 1 row affected (0.00 sec)`. + +--- task --- + +At the MariaDB prompt, grant database privileges to the root user. Change `YOURPASSWORD` to the password you created before. + +--- code --- +--- +language: sql +line_numbers: false +--- + +GRANT ALL PRIVILEGES ON wordpress.* TO 'root'@'localhost' IDENTIFIED BY 'YOURPASSWORD'; + +--- /code --- + +--- /task --- + +--- task --- + +For the changes to take effect, you will need to flush the database privileges: + +--- code --- +--- +language: sql +line_numbers: false +--- +FLUSH PRIVILEGES; + +--- /code --- + +--- /task --- + +--- task --- + +Exit the MariaDB prompt with Ctrl + D. + +--- /task --- + +--- task --- + +Restart your Raspberry Pi by typing this command in the terminal: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo reboot + +--- /code --- + +--- /task --- diff --git a/el-GR/step_7.md b/el-GR/step_7.md new file mode 100644 index 0000000..be18128 --- /dev/null +++ b/el-GR/step_7.md @@ -0,0 +1,155 @@ +## WordPress configuration + +--- task --- + +Once your Raspberry Pi has rebooted, open Chromium and type `localhost` into the address bar. + +You should see a WordPress page asking to pick your language. + +![WordPress select language](images/wordpress_language.png) + +--- /task --- + +--- task --- + +Select your language and click **Continue**. + +--- /task --- + +You will be presented with the WordPress welcome screen. + +![WordPress welcome screen](images/wordpress-welcome.png) + +--- task --- + +Click the **Let's go!** button. + +--- /task --- + +--- task --- + +Now fill out the basic site information as follows: **Tip:** Make sure you type `wordpress` in the first box as the text displayed is only a suggestion, the box is blank. + +``` +Database Name: wordpress +User Name: root +Password: +Database Host: localhost +Table Prefix: wp_ +``` + +Click **Submit** to proceed. + +--- /task --- + + +--- task --- + +Click the **Run the install** button. + +--- /task --- + +--- task --- + +Fill in the information you are asked for, then click the `Install WordPress` button. + +--- /task --- + +--- task --- + +Log in, using the account you just created. + +Now you're logged in and have your site set up, you can see the website by visiting your `http://localhost/wp-admin`. + +--- /task --- + + +### Friendly permalinks + +It's recommended that you change your permalink settings to make your URLs more friendly. + +--- task --- + +Log in to WordPress and go to the dashboard. + +--- /task --- + +--- task --- + +Go to **Setting**, then **Permalinks**. + +--- /task --- + +--- task --- + +Select the **Post name** option and click **Save Changes**. + +--- /task --- + +--- task --- + +Type the following command in a terminal to enable Apache's `rewrite` mod: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo a2enmod rewrite + +--- /code --- + +--- /task --- + +--- task --- + +Open the Apache configuration file + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo geany /etc/apache2/sites-available/000-default.conf + +--- /code --- + +--- /task --- + +--- task --- + +Add the following lines after line 1. + +--- code --- +--- +language: sql line_numbers: true line_number_start: 2 +line_highlights: 3-5 +--- + AllowOverride All + +--- /code --- + +--- /task --- + +--- task --- + +Save the file and close Geany. + +--- /task --- + +--- task --- + +In a terminal type the command to restart Apache: + + + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo service apache2 restart + +--- /code --- + +--- /task --- \ No newline at end of file diff --git a/el-GR/step_8.md b/el-GR/step_8.md new file mode 100644 index 0000000..2e023a0 --- /dev/null +++ b/el-GR/step_8.md @@ -0,0 +1,17 @@ +## Challenge + +--- challenge --- + +--- task --- + +Add more pages to your website. + +--- /task --- + +--- task --- + +Install a different theme from the Appearance menu. + +--- /task --- + +--- /challenge --- diff --git a/el-GR/step_9.md b/el-GR/step_9.md new file mode 100644 index 0000000..fc5847a --- /dev/null +++ b/el-GR/step_9.md @@ -0,0 +1,3 @@ +## What can you do now? + +You could try setting up a [Python web server with Flask](https://projects.raspberrypi.org/en/projects/python-web-server-with-flask) \ No newline at end of file diff --git a/en-US/images/Python-Webserver-with-Wordpress-TILE-01.png b/en-US/images/Python-Webserver-with-Wordpress-TILE-01.png new file mode 100644 index 0000000..f632634 Binary files /dev/null and b/en-US/images/Python-Webserver-with-Wordpress-TILE-01.png differ diff --git a/en-US/images/Python-Webserver-with-Wordpress.png b/en-US/images/Python-Webserver-with-Wordpress.png new file mode 100644 index 0000000..07b0191 Binary files /dev/null and b/en-US/images/Python-Webserver-with-Wordpress.png differ diff --git a/en-US/images/apache-hello-world.png b/en-US/images/apache-hello-world.png new file mode 100644 index 0000000..69fb339 Binary files /dev/null and b/en-US/images/apache-hello-world.png differ diff --git a/en-US/images/apache-it-works.png b/en-US/images/apache-it-works.png new file mode 100644 index 0000000..fb71d9f Binary files /dev/null and b/en-US/images/apache-it-works.png differ diff --git a/en-US/images/banner.png b/en-US/images/banner.png new file mode 100644 index 0000000..88a7bfb Binary files /dev/null and b/en-US/images/banner.png differ diff --git a/en-US/images/create-database.png b/en-US/images/create-database.png new file mode 100644 index 0000000..34c91f2 Binary files /dev/null and b/en-US/images/create-database.png differ diff --git a/en-US/images/hostname.png b/en-US/images/hostname.png new file mode 100644 index 0000000..bb50249 Binary files /dev/null and b/en-US/images/hostname.png differ diff --git a/en-US/images/hostname_annotated.png b/en-US/images/hostname_annotated.png new file mode 100644 index 0000000..27b2f08 Binary files /dev/null and b/en-US/images/hostname_annotated.png differ diff --git a/en-US/images/install_apache.png b/en-US/images/install_apache.png new file mode 100644 index 0000000..8b5dab8 Binary files /dev/null and b/en-US/images/install_apache.png differ diff --git a/en-US/images/wordpress-database-setup.png b/en-US/images/wordpress-database-setup.png new file mode 100644 index 0000000..a1b2a91 Binary files /dev/null and b/en-US/images/wordpress-database-setup.png differ diff --git a/en-US/images/wordpress-information_needed.png b/en-US/images/wordpress-information_needed.png new file mode 100644 index 0000000..8119d0a Binary files /dev/null and b/en-US/images/wordpress-information_needed.png differ diff --git a/en-US/images/wordpress-run-installation.png b/en-US/images/wordpress-run-installation.png new file mode 100644 index 0000000..b368d00 Binary files /dev/null and b/en-US/images/wordpress-run-installation.png differ diff --git a/en-US/images/wordpress-welcome.png b/en-US/images/wordpress-welcome.png new file mode 100644 index 0000000..9394739 Binary files /dev/null and b/en-US/images/wordpress-welcome.png differ diff --git a/en-US/images/wordpress_language.png b/en-US/images/wordpress_language.png new file mode 100644 index 0000000..4d44ba3 Binary files /dev/null and b/en-US/images/wordpress_language.png differ diff --git a/en-US/images/wp-info.png b/en-US/images/wp-info.png new file mode 100644 index 0000000..032e62e Binary files /dev/null and b/en-US/images/wp-info.png differ diff --git a/en-US/meta.yml b/en-US/meta.yml new file mode 100644 index 0000000..b615eb5 --- /dev/null +++ b/en-US/meta.yml @@ -0,0 +1,42 @@ +--- +title: Build a LAMP Web Server with WordPress +hero_image: images/banner.png +description: Set up a local server for a website on your Raspberry Pi +original_url: https://raspberrypi.org/learning/lamp-web-server-with-wordpress +theme: turquoise +duration: 2 +listed: true +ingredient: false +copyedit: false +curriculum: 3, design-0, programming-3, phys-comp-0, manufacture-0, community-0 +interests: '' +technologies: raspberry-pi, html-css-javascript +site_areas: projects +hardware: raspberry-pi +software: html-css-javascript +version: 4 +last_tested: 2017-01-01 +steps: + - + title: Introduction + - + title: Set up an Apache web server + completion: + - engaged + - + title: Install PHP + - + title: Install MariaDB + - + title: Download WordPress + - + title: Set up your WordPress database + completion: + - internal + - + title: WordPress configuration + completion: + - external + - + title: Challenge + challenge: true diff --git a/en-US/step_1.md b/en-US/step_1.md new file mode 100644 index 0000000..07a38ca --- /dev/null +++ b/en-US/step_1.md @@ -0,0 +1,12 @@ +## What you will make +Learn to set up a LAMP (**L**inux, **A**pache, **M**ySQL, **P**HP) stack on your Raspberry Pi and configure it to work as a web server. + + - Install software on your Raspberry Pi + - Install and configure Apache, PHP, and MySQL to create a LAMP web server + - Download WordPress and run it as a local website on your Raspberry Pi + - Configure WordPress and make your website accessible to other devices on your local network + + +### You will need +- A Raspberry Pi computer connected to the internet +- [An up to date install of the Raspberry Pi OS](https://www.raspberrypi.org/downloads/) diff --git a/en-US/step_2.md b/en-US/step_2.md new file mode 100644 index 0000000..1cb6c47 --- /dev/null +++ b/en-US/step_2.md @@ -0,0 +1,110 @@ +## Set up an Apache web server + +Apache is a popular web server application you can install on the Raspberry Pi to allow it to serve web pages. + +On its own, Apache can serve HTML files over HTTP. With additional modules it can serve dynamic web pages using scripting languages such as PHP. + +### Install Apache + +--- task --- + +Open a terminal window by selecting **Accessories** > **Terminal** from the menu. + +--- /task --- + +--- task --- + +Type the following command into the terminal and press Enter to install `apache2` + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo apt install apache2 -y + +--- /code --- + +**Tip:** If you see an error, make sure you are using the latest version of Raspberry Pi OS. + +--- /task --- + + +### Test the web server + +By default, Apache puts a test HTML file in the web folder that you will be able to view from your Pi or another computer on your network. + +--- task --- + +Open Chromium by selecting **Internet** > **Chromium Web Browser** from the menu. + +--- /task --- + +--- task --- + +Type `localhost` in the address bar. + +--- /task --- + +You should see this in your browser window: + +![Apache it works](images/apache-it-works.png) + +This means you have Apache working! + +### Changing the default web page + +This default web page is just a HTML file on the file system. It is located at `/var/www/html/index.html`. + +--- task --- + +Type the following command in the terminal to change to the directory containing the HTML file: + +--- code --- +--- +language: bash +line_numbers: false +--- +cd /var/www/html + +--- /code --- + +--- /task --- + +--- task --- + +Open the `index.html` file using Thonny + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo thonny index.html + +--- /code --- + +--- /task --- + +--- task --- + +Delete the contents of the file, then type a short message and save your changes. + +--- /task --- + +--- task --- + +Go back to Chromium and refresh the browser. You will see your message appear on the web page. + +--- /task --- + +--- collapse --- +--- +title: Access the page from another device on the network +--- + +You can open your web page from any other computer on your network, using the IP address of your Raspberry Pi, e.g. `http://192.168.1.10`. + +To find out your Raspberry Pi's IP address, type `hostname -I` into the terminal window. + +--- /collapse --- diff --git a/en-US/step_3.md b/en-US/step_3.md new file mode 100644 index 0000000..4bb6e7f --- /dev/null +++ b/en-US/step_3.md @@ -0,0 +1,91 @@ +## Install PHP + +PHP is a **preprocessor**: it's code that runs when the server receives a request for a web page via a web browser. It works out what needs to be shown on the page, and then sends that page to the browser. + +--- task --- + +Type the following command in the terminal to install PHP: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo apt install php -y + +--- /code --- + +--- /task --- + +### Test PHP + +--- task --- + +Type this command to delete the `index.html` file from earlier: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo rm index.html + +--- /code --- + +--- /task --- + +--- task --- + +Create a new file called `index.php`: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo thonny index.php + +--- /code --- + +--- /task --- + +--- task --- + +In the Thonny code editor, type this PHP code into the file and save it. + +--- code --- +--- +language: php +line_numbers: false +--- + + +--- /code --- + +--- /task --- + +--- task --- + +Refresh your browser. You should see "hello world". This page is not dynamic, but it is still served by PHP. + +![hello world](images/apache-hello-world.png) + +--- /task --- + + +--- collapse --- +--- +title: I can only see PHP code +--- +If you see the raw PHP above instead of "hello world", use this command to reload and restart Apache: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo service apache2 restart + +--- /code --- + +--- /collapse --- diff --git a/en-US/step_4.md b/en-US/step_4.md new file mode 100644 index 0000000..cc6eae1 --- /dev/null +++ b/en-US/step_4.md @@ -0,0 +1,75 @@ +## Install MariaDB + +MariaDB is a popular database engine. Like PHP, it's widely used on web servers, which is why projects like WordPress use it, and why those projects are so popular. + + +--- task --- + +Type this command to install the MariaDB Server and PHP-MySQL packages: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo apt install mariadb-server php-mysql -y + +--- /code --- + +--- /task --- + +--- task --- + +Now restart Apache: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo service apache2 restart + +--- /code --- + +--- /task --- + +### Set up + +--- task --- + +Run the MySQL secure installation command in the terminal window. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo mysql_secure_installation + +--- /code --- + +--- /task --- + +--- task --- + +Go through the setup wizard using the following answers: + ++ `Enter current password for root (enter for none):` — press **Enter**. + ++ `Switch to unix_socket authentication [Y/n]` - Type in **N** and press **Enter** + ++ `Change the root password?` - Type in **Y** and press **Enter** + ++ `New password:` - Type in a password and press **Enter**, then repeat a second time. **Important:** remember this root password, as you will need it later to set up WordPress. + ++ `Remove anonymous users` - Type in **Y** + ++ `Disallow root login remotely` - Type in **Y** + ++ `Remove test database and access to it` - Type in **Y** + ++ `Reload privilege tables now` - Type in **Y** + +--- /task --- + +When complete, you will see the message `All done!` and `Thanks for using MariaDB!`. diff --git a/en-US/step_5.md b/en-US/step_5.md new file mode 100644 index 0000000..d34db90 --- /dev/null +++ b/en-US/step_5.md @@ -0,0 +1,109 @@ +## Download WordPress + +WordPress is a popular tool used to quickly create a website or blog with an easy to use editor for creating new content. + + +--- task --- + +In your terminal, make sure you are still in the directory `/var/www/html/` + +--- code --- +--- +language: bash +line_numbers: false +--- +cd /var/www/html/ + +--- /code --- + +--- /task --- + +--- task --- + +Delete all the files in the folder. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo rm * + +--- /code --- + +--- /task --- + +--- task --- + +Type this command to download WordPress + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo wget http://wordpress.org/latest.tar.gz + +--- /code --- + +--- /task --- + +--- task --- + +Extract the WordPress software: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo tar xzf latest.tar.gz + +--- /code --- + +--- /task --- + +--- task --- + +Move the contents of the extracted `wordpress` directory to the current directory. **Tip:** Make sure you type the whole command including the dot. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo mv wordpress/* . + +--- /code --- + +--- /task --- + +--- task --- + +Tidy up by removing the download, and the now empty `wordpress` directory. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo rm -rf wordpress latest.tar.gz + +--- /code --- + +--- /task --- + +---task --- + +Change the ownership of all these files to the Apache user: **Tip:** Make sure you type the whole command including the dot. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo chown -R www-data: . + +--- /code --- + +--- /task --- diff --git a/en-US/step_6.md b/en-US/step_6.md new file mode 100644 index 0000000..eefa5ec --- /dev/null +++ b/en-US/step_6.md @@ -0,0 +1,95 @@ +## Set up your WordPress Database + +--- task --- + +Run `mysql` in the terminal window: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo mysql -uroot -p + +--- /code --- + +--- /task --- + +--- task --- + +Enter the root password you created when you set up the database. + +You will see the message `Welcome to the MariaDB monitor` and then the `MariaDB [(none)]>` prompt. + +--- /task --- + +--- task --- + +At the `MariaDB [(none)]>` prompt, type: **Tip:** Don't forget to type the semicolon at the end. + +--- code --- +--- +language: sql +line_numbers: false +--- +create database wordpress; + +--- /code --- + + + +--- /task --- + +If this has been successful, you should see `Query OK, 1 row affected (0.00 sec)`. + +--- task --- + +At the MariaDB prompt, grant database privileges to the root user. Change `YOURPASSWORD` to the password you created before. + +--- code --- +--- +language: sql +line_numbers: false +--- + +GRANT ALL PRIVILEGES ON wordpress.* TO 'root'@'localhost' IDENTIFIED BY 'YOURPASSWORD'; + +--- /code --- + +--- /task --- + +--- task --- + +For the changes to take effect, you will need to flush the database privileges: + +--- code --- +--- +language: sql +line_numbers: false +--- +FLUSH PRIVILEGES; + +--- /code --- + +--- /task --- + +--- task --- + +Exit the MariaDB prompt with Ctrl + D. + +--- /task --- + +--- task --- + +Restart your Raspberry Pi by typing this command in the terminal: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo reboot + +--- /code --- + +--- /task --- diff --git a/en-US/step_7.md b/en-US/step_7.md new file mode 100644 index 0000000..be18128 --- /dev/null +++ b/en-US/step_7.md @@ -0,0 +1,155 @@ +## WordPress configuration + +--- task --- + +Once your Raspberry Pi has rebooted, open Chromium and type `localhost` into the address bar. + +You should see a WordPress page asking to pick your language. + +![WordPress select language](images/wordpress_language.png) + +--- /task --- + +--- task --- + +Select your language and click **Continue**. + +--- /task --- + +You will be presented with the WordPress welcome screen. + +![WordPress welcome screen](images/wordpress-welcome.png) + +--- task --- + +Click the **Let's go!** button. + +--- /task --- + +--- task --- + +Now fill out the basic site information as follows: **Tip:** Make sure you type `wordpress` in the first box as the text displayed is only a suggestion, the box is blank. + +``` +Database Name: wordpress +User Name: root +Password: +Database Host: localhost +Table Prefix: wp_ +``` + +Click **Submit** to proceed. + +--- /task --- + + +--- task --- + +Click the **Run the install** button. + +--- /task --- + +--- task --- + +Fill in the information you are asked for, then click the `Install WordPress` button. + +--- /task --- + +--- task --- + +Log in, using the account you just created. + +Now you're logged in and have your site set up, you can see the website by visiting your `http://localhost/wp-admin`. + +--- /task --- + + +### Friendly permalinks + +It's recommended that you change your permalink settings to make your URLs more friendly. + +--- task --- + +Log in to WordPress and go to the dashboard. + +--- /task --- + +--- task --- + +Go to **Setting**, then **Permalinks**. + +--- /task --- + +--- task --- + +Select the **Post name** option and click **Save Changes**. + +--- /task --- + +--- task --- + +Type the following command in a terminal to enable Apache's `rewrite` mod: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo a2enmod rewrite + +--- /code --- + +--- /task --- + +--- task --- + +Open the Apache configuration file + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo geany /etc/apache2/sites-available/000-default.conf + +--- /code --- + +--- /task --- + +--- task --- + +Add the following lines after line 1. + +--- code --- +--- +language: sql line_numbers: true line_number_start: 2 +line_highlights: 3-5 +--- + AllowOverride All + +--- /code --- + +--- /task --- + +--- task --- + +Save the file and close Geany. + +--- /task --- + +--- task --- + +In a terminal type the command to restart Apache: + + + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo service apache2 restart + +--- /code --- + +--- /task --- \ No newline at end of file diff --git a/en-US/step_8.md b/en-US/step_8.md new file mode 100644 index 0000000..2e023a0 --- /dev/null +++ b/en-US/step_8.md @@ -0,0 +1,17 @@ +## Challenge + +--- challenge --- + +--- task --- + +Add more pages to your website. + +--- /task --- + +--- task --- + +Install a different theme from the Appearance menu. + +--- /task --- + +--- /challenge --- diff --git a/en-US/step_9.md b/en-US/step_9.md new file mode 100644 index 0000000..fc5847a --- /dev/null +++ b/en-US/step_9.md @@ -0,0 +1,3 @@ +## What can you do now? + +You could try setting up a [Python web server with Flask](https://projects.raspberrypi.org/en/projects/python-web-server-with-flask) \ No newline at end of file diff --git a/es-ES/images/Python-Webserver-with-Wordpress-TILE-01.png b/es-ES/images/Python-Webserver-with-Wordpress-TILE-01.png new file mode 100644 index 0000000..f632634 Binary files /dev/null and b/es-ES/images/Python-Webserver-with-Wordpress-TILE-01.png differ diff --git a/es-ES/images/Python-Webserver-with-Wordpress.png b/es-ES/images/Python-Webserver-with-Wordpress.png new file mode 100644 index 0000000..07b0191 Binary files /dev/null and b/es-ES/images/Python-Webserver-with-Wordpress.png differ diff --git a/es-ES/images/apache-hello-world.png b/es-ES/images/apache-hello-world.png new file mode 100644 index 0000000..69fb339 Binary files /dev/null and b/es-ES/images/apache-hello-world.png differ diff --git a/es-ES/images/apache-it-works.png b/es-ES/images/apache-it-works.png new file mode 100644 index 0000000..fb71d9f Binary files /dev/null and b/es-ES/images/apache-it-works.png differ diff --git a/es-ES/images/banner.png b/es-ES/images/banner.png new file mode 100644 index 0000000..88a7bfb Binary files /dev/null and b/es-ES/images/banner.png differ diff --git a/es-ES/images/create-database.png b/es-ES/images/create-database.png new file mode 100644 index 0000000..34c91f2 Binary files /dev/null and b/es-ES/images/create-database.png differ diff --git a/es-ES/images/hostname.png b/es-ES/images/hostname.png new file mode 100644 index 0000000..bb50249 Binary files /dev/null and b/es-ES/images/hostname.png differ diff --git a/es-ES/images/hostname_annotated.png b/es-ES/images/hostname_annotated.png new file mode 100644 index 0000000..27b2f08 Binary files /dev/null and b/es-ES/images/hostname_annotated.png differ diff --git a/es-ES/images/install_apache.png b/es-ES/images/install_apache.png new file mode 100644 index 0000000..8b5dab8 Binary files /dev/null and b/es-ES/images/install_apache.png differ diff --git a/es-ES/images/wordpress-database-setup.png b/es-ES/images/wordpress-database-setup.png new file mode 100644 index 0000000..a1b2a91 Binary files /dev/null and b/es-ES/images/wordpress-database-setup.png differ diff --git a/es-ES/images/wordpress-information_needed.png b/es-ES/images/wordpress-information_needed.png new file mode 100644 index 0000000..8119d0a Binary files /dev/null and b/es-ES/images/wordpress-information_needed.png differ diff --git a/es-ES/images/wordpress-run-installation.png b/es-ES/images/wordpress-run-installation.png new file mode 100644 index 0000000..b368d00 Binary files /dev/null and b/es-ES/images/wordpress-run-installation.png differ diff --git a/es-ES/images/wordpress-welcome.png b/es-ES/images/wordpress-welcome.png new file mode 100644 index 0000000..9394739 Binary files /dev/null and b/es-ES/images/wordpress-welcome.png differ diff --git a/es-ES/images/wordpress_language.png b/es-ES/images/wordpress_language.png new file mode 100644 index 0000000..4d44ba3 Binary files /dev/null and b/es-ES/images/wordpress_language.png differ diff --git a/es-ES/images/wp-info.png b/es-ES/images/wp-info.png new file mode 100644 index 0000000..032e62e Binary files /dev/null and b/es-ES/images/wp-info.png differ diff --git a/es-ES/meta.yml b/es-ES/meta.yml new file mode 100644 index 0000000..b0e3ba6 --- /dev/null +++ b/es-ES/meta.yml @@ -0,0 +1,42 @@ +--- +title: Build a LAMP Web Server with WordPress +hero_image: images / banner.png +description: Set up a local server for a website on your Raspberry Pi +original_url: https://raspberrypi.org/learning/lamp-web-server-with-wordpress +theme: turquoise +duration: 2 +listed: true +ingredient: false +copyedit: false +curriculum: 3, design-0, programming-3, phys-comp-0, manufacture-0, community-0 +interests: '' +technologies: raspberry-pi, html-css-javascript +site_areas: projects +hardware: raspberry-pi +software: html-css-javascript +version: 4 +last_tested: 2017-01-01 +steps: + - + title: Introducción + - + title: Set up an Apache web server + completion: + - engaged + - + title: Install PHP + - + title: Install MariaDB + - + title: Download WordPress + - + title: Set up your WordPress database + completion: + - internal + - + title: WordPress configuration + completion: + - external + - + title: Challenge + challenge: true diff --git a/es-ES/step_1.md b/es-ES/step_1.md new file mode 100644 index 0000000..d4ff435 --- /dev/null +++ b/es-ES/step_1.md @@ -0,0 +1,12 @@ +## Lo que harás +Learn to set up a LAMP (**L**inux, **A**pache, **M**ySQL, **P**HP) stack on your Raspberry Pi and configure it to work as a web server. + + - Install software on your Raspberry Pi + - Install and configure Apache, PHP, and MySQL to create a LAMP web server + - Download WordPress and run it as a local website on your Raspberry Pi + - Configure WordPress and make your website accessible to other devices on your local network + + +### You will need +- A Raspberry Pi computer connected to the internet +- [An up to date install of the Raspberry Pi OS](https://www.raspberrypi.org/downloads/) diff --git a/es-ES/step_2.md b/es-ES/step_2.md new file mode 100644 index 0000000..1cb6c47 --- /dev/null +++ b/es-ES/step_2.md @@ -0,0 +1,110 @@ +## Set up an Apache web server + +Apache is a popular web server application you can install on the Raspberry Pi to allow it to serve web pages. + +On its own, Apache can serve HTML files over HTTP. With additional modules it can serve dynamic web pages using scripting languages such as PHP. + +### Install Apache + +--- task --- + +Open a terminal window by selecting **Accessories** > **Terminal** from the menu. + +--- /task --- + +--- task --- + +Type the following command into the terminal and press Enter to install `apache2` + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo apt install apache2 -y + +--- /code --- + +**Tip:** If you see an error, make sure you are using the latest version of Raspberry Pi OS. + +--- /task --- + + +### Test the web server + +By default, Apache puts a test HTML file in the web folder that you will be able to view from your Pi or another computer on your network. + +--- task --- + +Open Chromium by selecting **Internet** > **Chromium Web Browser** from the menu. + +--- /task --- + +--- task --- + +Type `localhost` in the address bar. + +--- /task --- + +You should see this in your browser window: + +![Apache it works](images/apache-it-works.png) + +This means you have Apache working! + +### Changing the default web page + +This default web page is just a HTML file on the file system. It is located at `/var/www/html/index.html`. + +--- task --- + +Type the following command in the terminal to change to the directory containing the HTML file: + +--- code --- +--- +language: bash +line_numbers: false +--- +cd /var/www/html + +--- /code --- + +--- /task --- + +--- task --- + +Open the `index.html` file using Thonny + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo thonny index.html + +--- /code --- + +--- /task --- + +--- task --- + +Delete the contents of the file, then type a short message and save your changes. + +--- /task --- + +--- task --- + +Go back to Chromium and refresh the browser. You will see your message appear on the web page. + +--- /task --- + +--- collapse --- +--- +title: Access the page from another device on the network +--- + +You can open your web page from any other computer on your network, using the IP address of your Raspberry Pi, e.g. `http://192.168.1.10`. + +To find out your Raspberry Pi's IP address, type `hostname -I` into the terminal window. + +--- /collapse --- diff --git a/es-ES/step_3.md b/es-ES/step_3.md new file mode 100644 index 0000000..4bb6e7f --- /dev/null +++ b/es-ES/step_3.md @@ -0,0 +1,91 @@ +## Install PHP + +PHP is a **preprocessor**: it's code that runs when the server receives a request for a web page via a web browser. It works out what needs to be shown on the page, and then sends that page to the browser. + +--- task --- + +Type the following command in the terminal to install PHP: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo apt install php -y + +--- /code --- + +--- /task --- + +### Test PHP + +--- task --- + +Type this command to delete the `index.html` file from earlier: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo rm index.html + +--- /code --- + +--- /task --- + +--- task --- + +Create a new file called `index.php`: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo thonny index.php + +--- /code --- + +--- /task --- + +--- task --- + +In the Thonny code editor, type this PHP code into the file and save it. + +--- code --- +--- +language: php +line_numbers: false +--- + + +--- /code --- + +--- /task --- + +--- task --- + +Refresh your browser. You should see "hello world". This page is not dynamic, but it is still served by PHP. + +![hello world](images/apache-hello-world.png) + +--- /task --- + + +--- collapse --- +--- +title: I can only see PHP code +--- +If you see the raw PHP above instead of "hello world", use this command to reload and restart Apache: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo service apache2 restart + +--- /code --- + +--- /collapse --- diff --git a/es-ES/step_4.md b/es-ES/step_4.md new file mode 100644 index 0000000..cc6eae1 --- /dev/null +++ b/es-ES/step_4.md @@ -0,0 +1,75 @@ +## Install MariaDB + +MariaDB is a popular database engine. Like PHP, it's widely used on web servers, which is why projects like WordPress use it, and why those projects are so popular. + + +--- task --- + +Type this command to install the MariaDB Server and PHP-MySQL packages: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo apt install mariadb-server php-mysql -y + +--- /code --- + +--- /task --- + +--- task --- + +Now restart Apache: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo service apache2 restart + +--- /code --- + +--- /task --- + +### Set up + +--- task --- + +Run the MySQL secure installation command in the terminal window. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo mysql_secure_installation + +--- /code --- + +--- /task --- + +--- task --- + +Go through the setup wizard using the following answers: + ++ `Enter current password for root (enter for none):` — press **Enter**. + ++ `Switch to unix_socket authentication [Y/n]` - Type in **N** and press **Enter** + ++ `Change the root password?` - Type in **Y** and press **Enter** + ++ `New password:` - Type in a password and press **Enter**, then repeat a second time. **Important:** remember this root password, as you will need it later to set up WordPress. + ++ `Remove anonymous users` - Type in **Y** + ++ `Disallow root login remotely` - Type in **Y** + ++ `Remove test database and access to it` - Type in **Y** + ++ `Reload privilege tables now` - Type in **Y** + +--- /task --- + +When complete, you will see the message `All done!` and `Thanks for using MariaDB!`. diff --git a/es-ES/step_5.md b/es-ES/step_5.md new file mode 100644 index 0000000..d34db90 --- /dev/null +++ b/es-ES/step_5.md @@ -0,0 +1,109 @@ +## Download WordPress + +WordPress is a popular tool used to quickly create a website or blog with an easy to use editor for creating new content. + + +--- task --- + +In your terminal, make sure you are still in the directory `/var/www/html/` + +--- code --- +--- +language: bash +line_numbers: false +--- +cd /var/www/html/ + +--- /code --- + +--- /task --- + +--- task --- + +Delete all the files in the folder. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo rm * + +--- /code --- + +--- /task --- + +--- task --- + +Type this command to download WordPress + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo wget http://wordpress.org/latest.tar.gz + +--- /code --- + +--- /task --- + +--- task --- + +Extract the WordPress software: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo tar xzf latest.tar.gz + +--- /code --- + +--- /task --- + +--- task --- + +Move the contents of the extracted `wordpress` directory to the current directory. **Tip:** Make sure you type the whole command including the dot. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo mv wordpress/* . + +--- /code --- + +--- /task --- + +--- task --- + +Tidy up by removing the download, and the now empty `wordpress` directory. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo rm -rf wordpress latest.tar.gz + +--- /code --- + +--- /task --- + +---task --- + +Change the ownership of all these files to the Apache user: **Tip:** Make sure you type the whole command including the dot. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo chown -R www-data: . + +--- /code --- + +--- /task --- diff --git a/es-ES/step_6.md b/es-ES/step_6.md new file mode 100644 index 0000000..eefa5ec --- /dev/null +++ b/es-ES/step_6.md @@ -0,0 +1,95 @@ +## Set up your WordPress Database + +--- task --- + +Run `mysql` in the terminal window: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo mysql -uroot -p + +--- /code --- + +--- /task --- + +--- task --- + +Enter the root password you created when you set up the database. + +You will see the message `Welcome to the MariaDB monitor` and then the `MariaDB [(none)]>` prompt. + +--- /task --- + +--- task --- + +At the `MariaDB [(none)]>` prompt, type: **Tip:** Don't forget to type the semicolon at the end. + +--- code --- +--- +language: sql +line_numbers: false +--- +create database wordpress; + +--- /code --- + + + +--- /task --- + +If this has been successful, you should see `Query OK, 1 row affected (0.00 sec)`. + +--- task --- + +At the MariaDB prompt, grant database privileges to the root user. Change `YOURPASSWORD` to the password you created before. + +--- code --- +--- +language: sql +line_numbers: false +--- + +GRANT ALL PRIVILEGES ON wordpress.* TO 'root'@'localhost' IDENTIFIED BY 'YOURPASSWORD'; + +--- /code --- + +--- /task --- + +--- task --- + +For the changes to take effect, you will need to flush the database privileges: + +--- code --- +--- +language: sql +line_numbers: false +--- +FLUSH PRIVILEGES; + +--- /code --- + +--- /task --- + +--- task --- + +Exit the MariaDB prompt with Ctrl + D. + +--- /task --- + +--- task --- + +Restart your Raspberry Pi by typing this command in the terminal: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo reboot + +--- /code --- + +--- /task --- diff --git a/es-ES/step_7.md b/es-ES/step_7.md new file mode 100644 index 0000000..be18128 --- /dev/null +++ b/es-ES/step_7.md @@ -0,0 +1,155 @@ +## WordPress configuration + +--- task --- + +Once your Raspberry Pi has rebooted, open Chromium and type `localhost` into the address bar. + +You should see a WordPress page asking to pick your language. + +![WordPress select language](images/wordpress_language.png) + +--- /task --- + +--- task --- + +Select your language and click **Continue**. + +--- /task --- + +You will be presented with the WordPress welcome screen. + +![WordPress welcome screen](images/wordpress-welcome.png) + +--- task --- + +Click the **Let's go!** button. + +--- /task --- + +--- task --- + +Now fill out the basic site information as follows: **Tip:** Make sure you type `wordpress` in the first box as the text displayed is only a suggestion, the box is blank. + +``` +Database Name: wordpress +User Name: root +Password: +Database Host: localhost +Table Prefix: wp_ +``` + +Click **Submit** to proceed. + +--- /task --- + + +--- task --- + +Click the **Run the install** button. + +--- /task --- + +--- task --- + +Fill in the information you are asked for, then click the `Install WordPress` button. + +--- /task --- + +--- task --- + +Log in, using the account you just created. + +Now you're logged in and have your site set up, you can see the website by visiting your `http://localhost/wp-admin`. + +--- /task --- + + +### Friendly permalinks + +It's recommended that you change your permalink settings to make your URLs more friendly. + +--- task --- + +Log in to WordPress and go to the dashboard. + +--- /task --- + +--- task --- + +Go to **Setting**, then **Permalinks**. + +--- /task --- + +--- task --- + +Select the **Post name** option and click **Save Changes**. + +--- /task --- + +--- task --- + +Type the following command in a terminal to enable Apache's `rewrite` mod: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo a2enmod rewrite + +--- /code --- + +--- /task --- + +--- task --- + +Open the Apache configuration file + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo geany /etc/apache2/sites-available/000-default.conf + +--- /code --- + +--- /task --- + +--- task --- + +Add the following lines after line 1. + +--- code --- +--- +language: sql line_numbers: true line_number_start: 2 +line_highlights: 3-5 +--- + AllowOverride All + +--- /code --- + +--- /task --- + +--- task --- + +Save the file and close Geany. + +--- /task --- + +--- task --- + +In a terminal type the command to restart Apache: + + + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo service apache2 restart + +--- /code --- + +--- /task --- \ No newline at end of file diff --git a/es-ES/step_8.md b/es-ES/step_8.md new file mode 100644 index 0000000..2e023a0 --- /dev/null +++ b/es-ES/step_8.md @@ -0,0 +1,17 @@ +## Challenge + +--- challenge --- + +--- task --- + +Add more pages to your website. + +--- /task --- + +--- task --- + +Install a different theme from the Appearance menu. + +--- /task --- + +--- /challenge --- diff --git a/es-ES/step_9.md b/es-ES/step_9.md new file mode 100644 index 0000000..fc5847a --- /dev/null +++ b/es-ES/step_9.md @@ -0,0 +1,3 @@ +## What can you do now? + +You could try setting up a [Python web server with Flask](https://projects.raspberrypi.org/en/projects/python-web-server-with-flask) \ No newline at end of file diff --git a/fi-FI/images/Python-Webserver-with-Wordpress-TILE-01.png b/fi-FI/images/Python-Webserver-with-Wordpress-TILE-01.png new file mode 100644 index 0000000..f632634 Binary files /dev/null and b/fi-FI/images/Python-Webserver-with-Wordpress-TILE-01.png differ diff --git a/fi-FI/images/Python-Webserver-with-Wordpress.png b/fi-FI/images/Python-Webserver-with-Wordpress.png new file mode 100644 index 0000000..07b0191 Binary files /dev/null and b/fi-FI/images/Python-Webserver-with-Wordpress.png differ diff --git a/fi-FI/images/apache-hello-world.png b/fi-FI/images/apache-hello-world.png new file mode 100644 index 0000000..69fb339 Binary files /dev/null and b/fi-FI/images/apache-hello-world.png differ diff --git a/fi-FI/images/apache-it-works.png b/fi-FI/images/apache-it-works.png new file mode 100644 index 0000000..fb71d9f Binary files /dev/null and b/fi-FI/images/apache-it-works.png differ diff --git a/fi-FI/images/banner.png b/fi-FI/images/banner.png new file mode 100644 index 0000000..88a7bfb Binary files /dev/null and b/fi-FI/images/banner.png differ diff --git a/fi-FI/images/create-database.png b/fi-FI/images/create-database.png new file mode 100644 index 0000000..34c91f2 Binary files /dev/null and b/fi-FI/images/create-database.png differ diff --git a/fi-FI/images/hostname.png b/fi-FI/images/hostname.png new file mode 100644 index 0000000..bb50249 Binary files /dev/null and b/fi-FI/images/hostname.png differ diff --git a/fi-FI/images/hostname_annotated.png b/fi-FI/images/hostname_annotated.png new file mode 100644 index 0000000..27b2f08 Binary files /dev/null and b/fi-FI/images/hostname_annotated.png differ diff --git a/fi-FI/images/install_apache.png b/fi-FI/images/install_apache.png new file mode 100644 index 0000000..8b5dab8 Binary files /dev/null and b/fi-FI/images/install_apache.png differ diff --git a/fi-FI/images/wordpress-database-setup.png b/fi-FI/images/wordpress-database-setup.png new file mode 100644 index 0000000..a1b2a91 Binary files /dev/null and b/fi-FI/images/wordpress-database-setup.png differ diff --git a/fi-FI/images/wordpress-information_needed.png b/fi-FI/images/wordpress-information_needed.png new file mode 100644 index 0000000..8119d0a Binary files /dev/null and b/fi-FI/images/wordpress-information_needed.png differ diff --git a/fi-FI/images/wordpress-run-installation.png b/fi-FI/images/wordpress-run-installation.png new file mode 100644 index 0000000..b368d00 Binary files /dev/null and b/fi-FI/images/wordpress-run-installation.png differ diff --git a/fi-FI/images/wordpress-welcome.png b/fi-FI/images/wordpress-welcome.png new file mode 100644 index 0000000..9394739 Binary files /dev/null and b/fi-FI/images/wordpress-welcome.png differ diff --git a/fi-FI/images/wordpress_language.png b/fi-FI/images/wordpress_language.png new file mode 100644 index 0000000..4d44ba3 Binary files /dev/null and b/fi-FI/images/wordpress_language.png differ diff --git a/fi-FI/images/wp-info.png b/fi-FI/images/wp-info.png new file mode 100644 index 0000000..032e62e Binary files /dev/null and b/fi-FI/images/wp-info.png differ diff --git a/fi-FI/meta.yml b/fi-FI/meta.yml new file mode 100644 index 0000000..00beb5f --- /dev/null +++ b/fi-FI/meta.yml @@ -0,0 +1,42 @@ +--- +title: Build a LAMP Web Server with WordPress +hero_image: images/banner.png +description: Set up a local server for a website on your Raspberry Pi +original_url: https://raspberrypi.org/learning/lamp-web-server-with-wordpress +theme: turquoise +duration: 2 +listed: true +ingredient: false +copyedit: false +curriculum: 3, design-0, programming-3, phys-comp-0, manufacture-0, community-0 +interests: '' +technologies: raspberry-pi, html-css-javascript +site_areas: projects +hardware: raspberry-pi +software: html-css-javascript +version: 4 +last_tested: 01.1.2017 +steps: + - + title: Johdanto + - + title: Set up an Apache web server + completion: + - engaged + - + title: Install PHP + - + title: Install MariaDB + - + title: Download WordPress + - + title: Set up your WordPress database + completion: + - internal + - + title: WordPress configuration + completion: + - external + - + title: Challenge + challenge: true diff --git a/fi-FI/step_1.md b/fi-FI/step_1.md new file mode 100644 index 0000000..12b0a69 --- /dev/null +++ b/fi-FI/step_1.md @@ -0,0 +1,12 @@ +## Mitä tulet tekemään +Learn to set up a LAMP (**L**inux, **A**pache, **M**ySQL, **P**HP) stack on your Raspberry Pi and configure it to work as a web server. + + - Install software on your Raspberry Pi + - Install and configure Apache, PHP, and MySQL to create a LAMP web server + - Download WordPress and run it as a local website on your Raspberry Pi + - Configure WordPress and make your website accessible to other devices on your local network + + +### You will need +- A Raspberry Pi computer connected to the internet +- [An up to date install of the Raspberry Pi OS](https://www.raspberrypi.org/downloads/) diff --git a/fi-FI/step_2.md b/fi-FI/step_2.md new file mode 100644 index 0000000..1cb6c47 --- /dev/null +++ b/fi-FI/step_2.md @@ -0,0 +1,110 @@ +## Set up an Apache web server + +Apache is a popular web server application you can install on the Raspberry Pi to allow it to serve web pages. + +On its own, Apache can serve HTML files over HTTP. With additional modules it can serve dynamic web pages using scripting languages such as PHP. + +### Install Apache + +--- task --- + +Open a terminal window by selecting **Accessories** > **Terminal** from the menu. + +--- /task --- + +--- task --- + +Type the following command into the terminal and press Enter to install `apache2` + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo apt install apache2 -y + +--- /code --- + +**Tip:** If you see an error, make sure you are using the latest version of Raspberry Pi OS. + +--- /task --- + + +### Test the web server + +By default, Apache puts a test HTML file in the web folder that you will be able to view from your Pi or another computer on your network. + +--- task --- + +Open Chromium by selecting **Internet** > **Chromium Web Browser** from the menu. + +--- /task --- + +--- task --- + +Type `localhost` in the address bar. + +--- /task --- + +You should see this in your browser window: + +![Apache it works](images/apache-it-works.png) + +This means you have Apache working! + +### Changing the default web page + +This default web page is just a HTML file on the file system. It is located at `/var/www/html/index.html`. + +--- task --- + +Type the following command in the terminal to change to the directory containing the HTML file: + +--- code --- +--- +language: bash +line_numbers: false +--- +cd /var/www/html + +--- /code --- + +--- /task --- + +--- task --- + +Open the `index.html` file using Thonny + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo thonny index.html + +--- /code --- + +--- /task --- + +--- task --- + +Delete the contents of the file, then type a short message and save your changes. + +--- /task --- + +--- task --- + +Go back to Chromium and refresh the browser. You will see your message appear on the web page. + +--- /task --- + +--- collapse --- +--- +title: Access the page from another device on the network +--- + +You can open your web page from any other computer on your network, using the IP address of your Raspberry Pi, e.g. `http://192.168.1.10`. + +To find out your Raspberry Pi's IP address, type `hostname -I` into the terminal window. + +--- /collapse --- diff --git a/fi-FI/step_3.md b/fi-FI/step_3.md new file mode 100644 index 0000000..4bb6e7f --- /dev/null +++ b/fi-FI/step_3.md @@ -0,0 +1,91 @@ +## Install PHP + +PHP is a **preprocessor**: it's code that runs when the server receives a request for a web page via a web browser. It works out what needs to be shown on the page, and then sends that page to the browser. + +--- task --- + +Type the following command in the terminal to install PHP: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo apt install php -y + +--- /code --- + +--- /task --- + +### Test PHP + +--- task --- + +Type this command to delete the `index.html` file from earlier: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo rm index.html + +--- /code --- + +--- /task --- + +--- task --- + +Create a new file called `index.php`: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo thonny index.php + +--- /code --- + +--- /task --- + +--- task --- + +In the Thonny code editor, type this PHP code into the file and save it. + +--- code --- +--- +language: php +line_numbers: false +--- + + +--- /code --- + +--- /task --- + +--- task --- + +Refresh your browser. You should see "hello world". This page is not dynamic, but it is still served by PHP. + +![hello world](images/apache-hello-world.png) + +--- /task --- + + +--- collapse --- +--- +title: I can only see PHP code +--- +If you see the raw PHP above instead of "hello world", use this command to reload and restart Apache: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo service apache2 restart + +--- /code --- + +--- /collapse --- diff --git a/fi-FI/step_4.md b/fi-FI/step_4.md new file mode 100644 index 0000000..cc6eae1 --- /dev/null +++ b/fi-FI/step_4.md @@ -0,0 +1,75 @@ +## Install MariaDB + +MariaDB is a popular database engine. Like PHP, it's widely used on web servers, which is why projects like WordPress use it, and why those projects are so popular. + + +--- task --- + +Type this command to install the MariaDB Server and PHP-MySQL packages: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo apt install mariadb-server php-mysql -y + +--- /code --- + +--- /task --- + +--- task --- + +Now restart Apache: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo service apache2 restart + +--- /code --- + +--- /task --- + +### Set up + +--- task --- + +Run the MySQL secure installation command in the terminal window. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo mysql_secure_installation + +--- /code --- + +--- /task --- + +--- task --- + +Go through the setup wizard using the following answers: + ++ `Enter current password for root (enter for none):` — press **Enter**. + ++ `Switch to unix_socket authentication [Y/n]` - Type in **N** and press **Enter** + ++ `Change the root password?` - Type in **Y** and press **Enter** + ++ `New password:` - Type in a password and press **Enter**, then repeat a second time. **Important:** remember this root password, as you will need it later to set up WordPress. + ++ `Remove anonymous users` - Type in **Y** + ++ `Disallow root login remotely` - Type in **Y** + ++ `Remove test database and access to it` - Type in **Y** + ++ `Reload privilege tables now` - Type in **Y** + +--- /task --- + +When complete, you will see the message `All done!` and `Thanks for using MariaDB!`. diff --git a/fi-FI/step_5.md b/fi-FI/step_5.md new file mode 100644 index 0000000..d34db90 --- /dev/null +++ b/fi-FI/step_5.md @@ -0,0 +1,109 @@ +## Download WordPress + +WordPress is a popular tool used to quickly create a website or blog with an easy to use editor for creating new content. + + +--- task --- + +In your terminal, make sure you are still in the directory `/var/www/html/` + +--- code --- +--- +language: bash +line_numbers: false +--- +cd /var/www/html/ + +--- /code --- + +--- /task --- + +--- task --- + +Delete all the files in the folder. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo rm * + +--- /code --- + +--- /task --- + +--- task --- + +Type this command to download WordPress + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo wget http://wordpress.org/latest.tar.gz + +--- /code --- + +--- /task --- + +--- task --- + +Extract the WordPress software: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo tar xzf latest.tar.gz + +--- /code --- + +--- /task --- + +--- task --- + +Move the contents of the extracted `wordpress` directory to the current directory. **Tip:** Make sure you type the whole command including the dot. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo mv wordpress/* . + +--- /code --- + +--- /task --- + +--- task --- + +Tidy up by removing the download, and the now empty `wordpress` directory. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo rm -rf wordpress latest.tar.gz + +--- /code --- + +--- /task --- + +---task --- + +Change the ownership of all these files to the Apache user: **Tip:** Make sure you type the whole command including the dot. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo chown -R www-data: . + +--- /code --- + +--- /task --- diff --git a/fi-FI/step_6.md b/fi-FI/step_6.md new file mode 100644 index 0000000..eefa5ec --- /dev/null +++ b/fi-FI/step_6.md @@ -0,0 +1,95 @@ +## Set up your WordPress Database + +--- task --- + +Run `mysql` in the terminal window: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo mysql -uroot -p + +--- /code --- + +--- /task --- + +--- task --- + +Enter the root password you created when you set up the database. + +You will see the message `Welcome to the MariaDB monitor` and then the `MariaDB [(none)]>` prompt. + +--- /task --- + +--- task --- + +At the `MariaDB [(none)]>` prompt, type: **Tip:** Don't forget to type the semicolon at the end. + +--- code --- +--- +language: sql +line_numbers: false +--- +create database wordpress; + +--- /code --- + + + +--- /task --- + +If this has been successful, you should see `Query OK, 1 row affected (0.00 sec)`. + +--- task --- + +At the MariaDB prompt, grant database privileges to the root user. Change `YOURPASSWORD` to the password you created before. + +--- code --- +--- +language: sql +line_numbers: false +--- + +GRANT ALL PRIVILEGES ON wordpress.* TO 'root'@'localhost' IDENTIFIED BY 'YOURPASSWORD'; + +--- /code --- + +--- /task --- + +--- task --- + +For the changes to take effect, you will need to flush the database privileges: + +--- code --- +--- +language: sql +line_numbers: false +--- +FLUSH PRIVILEGES; + +--- /code --- + +--- /task --- + +--- task --- + +Exit the MariaDB prompt with Ctrl + D. + +--- /task --- + +--- task --- + +Restart your Raspberry Pi by typing this command in the terminal: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo reboot + +--- /code --- + +--- /task --- diff --git a/fi-FI/step_7.md b/fi-FI/step_7.md new file mode 100644 index 0000000..be18128 --- /dev/null +++ b/fi-FI/step_7.md @@ -0,0 +1,155 @@ +## WordPress configuration + +--- task --- + +Once your Raspberry Pi has rebooted, open Chromium and type `localhost` into the address bar. + +You should see a WordPress page asking to pick your language. + +![WordPress select language](images/wordpress_language.png) + +--- /task --- + +--- task --- + +Select your language and click **Continue**. + +--- /task --- + +You will be presented with the WordPress welcome screen. + +![WordPress welcome screen](images/wordpress-welcome.png) + +--- task --- + +Click the **Let's go!** button. + +--- /task --- + +--- task --- + +Now fill out the basic site information as follows: **Tip:** Make sure you type `wordpress` in the first box as the text displayed is only a suggestion, the box is blank. + +``` +Database Name: wordpress +User Name: root +Password: +Database Host: localhost +Table Prefix: wp_ +``` + +Click **Submit** to proceed. + +--- /task --- + + +--- task --- + +Click the **Run the install** button. + +--- /task --- + +--- task --- + +Fill in the information you are asked for, then click the `Install WordPress` button. + +--- /task --- + +--- task --- + +Log in, using the account you just created. + +Now you're logged in and have your site set up, you can see the website by visiting your `http://localhost/wp-admin`. + +--- /task --- + + +### Friendly permalinks + +It's recommended that you change your permalink settings to make your URLs more friendly. + +--- task --- + +Log in to WordPress and go to the dashboard. + +--- /task --- + +--- task --- + +Go to **Setting**, then **Permalinks**. + +--- /task --- + +--- task --- + +Select the **Post name** option and click **Save Changes**. + +--- /task --- + +--- task --- + +Type the following command in a terminal to enable Apache's `rewrite` mod: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo a2enmod rewrite + +--- /code --- + +--- /task --- + +--- task --- + +Open the Apache configuration file + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo geany /etc/apache2/sites-available/000-default.conf + +--- /code --- + +--- /task --- + +--- task --- + +Add the following lines after line 1. + +--- code --- +--- +language: sql line_numbers: true line_number_start: 2 +line_highlights: 3-5 +--- + AllowOverride All + +--- /code --- + +--- /task --- + +--- task --- + +Save the file and close Geany. + +--- /task --- + +--- task --- + +In a terminal type the command to restart Apache: + + + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo service apache2 restart + +--- /code --- + +--- /task --- \ No newline at end of file diff --git a/fi-FI/step_8.md b/fi-FI/step_8.md new file mode 100644 index 0000000..2e023a0 --- /dev/null +++ b/fi-FI/step_8.md @@ -0,0 +1,17 @@ +## Challenge + +--- challenge --- + +--- task --- + +Add more pages to your website. + +--- /task --- + +--- task --- + +Install a different theme from the Appearance menu. + +--- /task --- + +--- /challenge --- diff --git a/fi-FI/step_9.md b/fi-FI/step_9.md new file mode 100644 index 0000000..fc5847a --- /dev/null +++ b/fi-FI/step_9.md @@ -0,0 +1,3 @@ +## What can you do now? + +You could try setting up a [Python web server with Flask](https://projects.raspberrypi.org/en/projects/python-web-server-with-flask) \ No newline at end of file diff --git a/fr-FR/images/Python-Webserver-with-Wordpress-TILE-01.png b/fr-FR/images/Python-Webserver-with-Wordpress-TILE-01.png new file mode 100644 index 0000000..f632634 Binary files /dev/null and b/fr-FR/images/Python-Webserver-with-Wordpress-TILE-01.png differ diff --git a/fr-FR/images/Python-Webserver-with-Wordpress.png b/fr-FR/images/Python-Webserver-with-Wordpress.png new file mode 100644 index 0000000..07b0191 Binary files /dev/null and b/fr-FR/images/Python-Webserver-with-Wordpress.png differ diff --git a/fr-FR/images/apache-hello-world.png b/fr-FR/images/apache-hello-world.png new file mode 100644 index 0000000..8888c4c Binary files /dev/null and b/fr-FR/images/apache-hello-world.png differ diff --git a/fr-FR/images/apache-it-works.png b/fr-FR/images/apache-it-works.png new file mode 100644 index 0000000..fb71d9f Binary files /dev/null and b/fr-FR/images/apache-it-works.png differ diff --git a/fr-FR/images/banner.png b/fr-FR/images/banner.png new file mode 100644 index 0000000..88a7bfb Binary files /dev/null and b/fr-FR/images/banner.png differ diff --git a/fr-FR/images/create-database.png b/fr-FR/images/create-database.png new file mode 100644 index 0000000..93d1f19 Binary files /dev/null and b/fr-FR/images/create-database.png differ diff --git a/fr-FR/images/hostname.png b/fr-FR/images/hostname.png new file mode 100644 index 0000000..bb50249 Binary files /dev/null and b/fr-FR/images/hostname.png differ diff --git a/fr-FR/images/hostname_annotated.png b/fr-FR/images/hostname_annotated.png new file mode 100644 index 0000000..27b2f08 Binary files /dev/null and b/fr-FR/images/hostname_annotated.png differ diff --git a/fr-FR/images/install_apache.png b/fr-FR/images/install_apache.png new file mode 100644 index 0000000..8b5dab8 Binary files /dev/null and b/fr-FR/images/install_apache.png differ diff --git a/fr-FR/images/wordpress-database-setup.png b/fr-FR/images/wordpress-database-setup.png new file mode 100644 index 0000000..a1b2a91 Binary files /dev/null and b/fr-FR/images/wordpress-database-setup.png differ diff --git a/fr-FR/images/wordpress-information_needed.png b/fr-FR/images/wordpress-information_needed.png new file mode 100644 index 0000000..8119d0a Binary files /dev/null and b/fr-FR/images/wordpress-information_needed.png differ diff --git a/fr-FR/images/wordpress-run-installation.png b/fr-FR/images/wordpress-run-installation.png new file mode 100644 index 0000000..b368d00 Binary files /dev/null and b/fr-FR/images/wordpress-run-installation.png differ diff --git a/fr-FR/images/wordpress-welcome.png b/fr-FR/images/wordpress-welcome.png new file mode 100644 index 0000000..9394739 Binary files /dev/null and b/fr-FR/images/wordpress-welcome.png differ diff --git a/fr-FR/images/wordpress_language.png b/fr-FR/images/wordpress_language.png new file mode 100644 index 0000000..4d44ba3 Binary files /dev/null and b/fr-FR/images/wordpress_language.png differ diff --git a/fr-FR/images/wp-info.png b/fr-FR/images/wp-info.png new file mode 100644 index 0000000..032e62e Binary files /dev/null and b/fr-FR/images/wp-info.png differ diff --git a/fr-FR/meta.yml b/fr-FR/meta.yml new file mode 100644 index 0000000..1aee5dc --- /dev/null +++ b/fr-FR/meta.yml @@ -0,0 +1,42 @@ +--- +title: Créer un serveur Web LAMP avec WordPress +hero_image: images/banner.png +description: Configurer un serveur local pour un site Web sur ton Raspberry Pi +original_url: https://raspberrypi.org/learning/lamp-web-server-with-wordpress +theme: turquoise +duration: 2 +listed: true +ingredient: false +copyedit: false +curriculum: 3, design-0, programming-3, phys-comp-0, manufacture-0, community-0 +interests: '' +technologies: raspberry-pi, html-css-javascript +site_areas: projects +hardware: raspberry-pi +software: html-css-javascript +version: 4 +last_tested: 01/01/2017 +steps: + - + title: Introduction + - + title: Ce dont tu auras besoin + completion: + - engaged + - + title: Configurer un serveur Web Apache + - + title: Installer PHP + - + title: Installer MySQL + - + title: Télécharger WordPress + completion: + - internal + - + title: Configure ta base de données WordPress + completion: + - external + - + title: Configuration de WordPress + challenge: true diff --git a/fr-FR/step_1.md b/fr-FR/step_1.md new file mode 100644 index 0000000..8a2b5e1 --- /dev/null +++ b/fr-FR/step_1.md @@ -0,0 +1,12 @@ +## Ce que tu feras +Apprends à configurer un LAMP (**L**inux, **A**pache, **M**ySQL, **P**HP) sur ton Raspberry Pi et configure-le pour qu'il fonctionne comme un serveur Web. + + - Installer le logiciel sur ton Raspberry Pi + - Installer et configurer Apache, PHP et MySQL pour créer un serveur Web LAMP + - Télécharger WordPress et l'exécuter en tant que site Web local sur ton Raspberry Pi + - Configurer WordPress et rendre ton site Web accessible à d'autres appareils sur ton réseau local + + +### You will need +- A Raspberry Pi computer connected to the internet +- [An up to date install of the Raspberry Pi OS](https://www.raspberrypi.org/downloads/) diff --git a/fr-FR/step_2.md b/fr-FR/step_2.md new file mode 100644 index 0000000..1cb6c47 --- /dev/null +++ b/fr-FR/step_2.md @@ -0,0 +1,110 @@ +## Set up an Apache web server + +Apache is a popular web server application you can install on the Raspberry Pi to allow it to serve web pages. + +On its own, Apache can serve HTML files over HTTP. With additional modules it can serve dynamic web pages using scripting languages such as PHP. + +### Install Apache + +--- task --- + +Open a terminal window by selecting **Accessories** > **Terminal** from the menu. + +--- /task --- + +--- task --- + +Type the following command into the terminal and press Enter to install `apache2` + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo apt install apache2 -y + +--- /code --- + +**Tip:** If you see an error, make sure you are using the latest version of Raspberry Pi OS. + +--- /task --- + + +### Test the web server + +By default, Apache puts a test HTML file in the web folder that you will be able to view from your Pi or another computer on your network. + +--- task --- + +Open Chromium by selecting **Internet** > **Chromium Web Browser** from the menu. + +--- /task --- + +--- task --- + +Type `localhost` in the address bar. + +--- /task --- + +You should see this in your browser window: + +![Apache it works](images/apache-it-works.png) + +This means you have Apache working! + +### Changing the default web page + +This default web page is just a HTML file on the file system. It is located at `/var/www/html/index.html`. + +--- task --- + +Type the following command in the terminal to change to the directory containing the HTML file: + +--- code --- +--- +language: bash +line_numbers: false +--- +cd /var/www/html + +--- /code --- + +--- /task --- + +--- task --- + +Open the `index.html` file using Thonny + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo thonny index.html + +--- /code --- + +--- /task --- + +--- task --- + +Delete the contents of the file, then type a short message and save your changes. + +--- /task --- + +--- task --- + +Go back to Chromium and refresh the browser. You will see your message appear on the web page. + +--- /task --- + +--- collapse --- +--- +title: Access the page from another device on the network +--- + +You can open your web page from any other computer on your network, using the IP address of your Raspberry Pi, e.g. `http://192.168.1.10`. + +To find out your Raspberry Pi's IP address, type `hostname -I` into the terminal window. + +--- /collapse --- diff --git a/fr-FR/step_3.md b/fr-FR/step_3.md new file mode 100644 index 0000000..01ce2f1 --- /dev/null +++ b/fr-FR/step_3.md @@ -0,0 +1,91 @@ +## Installer Apache + +PHP is a **preprocessor**: it's code that runs when the server receives a request for a web page via a web browser. It works out what needs to be shown on the page, and then sends that page to the browser. + +--- task --- + +Type the following command in the terminal to install PHP: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo apt install php -y + +--- /code --- + +--- /task --- + +### Test PHP + +--- task --- + +Type this command to delete the `index.html` file from earlier: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo rm index.html + +--- /code --- + +--- /task --- + +--- task --- + +Create a new file called `index.php`: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo thonny index.php + +--- /code --- + +--- /task --- + +--- task --- + +In the Thonny code editor, type this PHP code into the file and save it. + +--- code --- +--- +language: php +line_numbers: false +--- + + +--- /code --- + +--- /task --- + +--- task --- + +Refresh your browser. You should see "hello world". This page is not dynamic, but it is still served by PHP. + +![hello world](images/apache-hello-world.png) + +--- /task --- + + +--- collapse --- +--- +title: I can only see PHP code +--- +If you see the raw PHP above instead of "hello world", use this command to reload and restart Apache: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo service apache2 restart + +--- /code --- + +--- /collapse --- diff --git a/fr-FR/step_4.md b/fr-FR/step_4.md new file mode 100644 index 0000000..440359c --- /dev/null +++ b/fr-FR/step_4.md @@ -0,0 +1,75 @@ +## Install MariaDB + +MariaDB is a popular database engine. PHP est un langage très populaire sur le Web : d'énormes projets comme Facebook et Wikipedia sont écrits en PHP. + + +--- task --- + +Installe le paquet PHP avec la commande suivante : + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo apt install mariadb-server php-mysql -y + +--- /code --- + +--- /task --- + +--- task --- + +Now restart Apache: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo service apache2 restart + +--- /code --- + +--- /task --- + +### Set up + +--- task --- + +Run the MySQL secure installation command in the terminal window. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo mysql_secure_installation + +--- /code --- + +--- /task --- + +--- task --- + +Go through the setup wizard using the following answers: + ++ `Enter current password for root (enter for none):` — press **Enter**. + ++ `Switch to unix_socket authentication [Y/n]` - Type in **N** and press **Enter** + ++ `Change the root password?` - Type in **Y** and press **Enter** + ++ `New password:` - Type in a password and press **Enter**, then repeat a second time. **Important:** remember this root password, as you will need it later to set up WordPress. + ++ `Remove anonymous users` - Type in **Y** + ++ `Disallow root login remotely` - Type in **Y** + ++ `Remove test database and access to it` - Type in **Y** + ++ `Reload privilege tables now` - Type in **Y** + +--- /task --- + +When complete, you will see the message `All done!` and `Thanks for using MariaDB!`. diff --git a/fr-FR/step_5.md b/fr-FR/step_5.md new file mode 100644 index 0000000..d34db90 --- /dev/null +++ b/fr-FR/step_5.md @@ -0,0 +1,109 @@ +## Download WordPress + +WordPress is a popular tool used to quickly create a website or blog with an easy to use editor for creating new content. + + +--- task --- + +In your terminal, make sure you are still in the directory `/var/www/html/` + +--- code --- +--- +language: bash +line_numbers: false +--- +cd /var/www/html/ + +--- /code --- + +--- /task --- + +--- task --- + +Delete all the files in the folder. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo rm * + +--- /code --- + +--- /task --- + +--- task --- + +Type this command to download WordPress + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo wget http://wordpress.org/latest.tar.gz + +--- /code --- + +--- /task --- + +--- task --- + +Extract the WordPress software: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo tar xzf latest.tar.gz + +--- /code --- + +--- /task --- + +--- task --- + +Move the contents of the extracted `wordpress` directory to the current directory. **Tip:** Make sure you type the whole command including the dot. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo mv wordpress/* . + +--- /code --- + +--- /task --- + +--- task --- + +Tidy up by removing the download, and the now empty `wordpress` directory. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo rm -rf wordpress latest.tar.gz + +--- /code --- + +--- /task --- + +---task --- + +Change the ownership of all these files to the Apache user: **Tip:** Make sure you type the whole command including the dot. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo chown -R www-data: . + +--- /code --- + +--- /task --- diff --git a/fr-FR/step_6.md b/fr-FR/step_6.md new file mode 100644 index 0000000..024e495 --- /dev/null +++ b/fr-FR/step_6.md @@ -0,0 +1,95 @@ +## Télécharger WordPress + +--- task --- + +Run `mysql` in the terminal window: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo mysql -uroot -p + +--- /code --- + +--- /task --- + +--- task --- + +Enter the root password you created when you set up the database. + +You will see the message `Welcome to the MariaDB monitor` and then the `MariaDB [(none)]>` prompt. + +--- /task --- + +--- task --- + +At the `MariaDB [(none)]>` prompt, type: **Tip:** Don't forget to type the semicolon at the end. + +--- code --- +--- +language: sql +line_numbers: false +--- +create database wordpress; + +--- /code --- + + + +--- /task --- + +If this has been successful, you should see `Query OK, 1 row affected (0.00 sec)`. + +--- task --- + +At the MariaDB prompt, grant database privileges to the root user. Change `YOURPASSWORD` to the password you created before. + +--- code --- +--- +language: sql +line_numbers: false +--- + +GRANT ALL PRIVILEGES ON wordpress.* TO 'root'@'localhost' IDENTIFIED BY 'YOURPASSWORD'; + +--- /code --- + +--- /task --- + +--- task --- + +For the changes to take effect, you will need to flush the database privileges: + +--- code --- +--- +language: sql +line_numbers: false +--- +FLUSH PRIVILEGES; + +--- /code --- + +--- /task --- + +--- task --- + +Exit the MariaDB prompt with Ctrl + D. + +--- /task --- + +--- task --- + +Restart your Raspberry Pi by typing this command in the terminal: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo reboot + +--- /code --- + +--- /task --- diff --git a/fr-FR/step_7.md b/fr-FR/step_7.md new file mode 100644 index 0000000..14398d9 --- /dev/null +++ b/fr-FR/step_7.md @@ -0,0 +1,155 @@ +## Configure ta base de données WordPress + +--- task --- + +Once your Raspberry Pi has rebooted, open Chromium and type `localhost` into the address bar. + +You should see a WordPress page asking to pick your language. + +![WordPress select language](images/wordpress_language.png) + +--- /task --- + +--- task --- + +Select your language and click **Continue**. + +--- /task --- + +You will be presented with the WordPress welcome screen. + +![WordPress welcome screen](images/wordpress-welcome.png) + +--- task --- + +Tape **O** à `Supprimer les utilisateurs anonymes`. + +--- /task --- + +--- task --- + +Now fill out the basic site information as follows: **Tip:** Make sure you type `wordpress` in the first box as the text displayed is only a suggestion, the box is blank. + +``` +Database Name: wordpress +User Name: root +Password: +Database Host: localhost +Table Prefix: wp_ +``` + +Tape **O** pour `Recharger les tables de privilèges maintenant`. + +--- /task --- + + +--- task --- + +Tape **O** et appuie sur **Entrée** pour `Définir le mot de passe root ?` . + +--- /task --- + +--- task --- + +Fill in the information you are asked for, then click the `Install WordPress` button. + +--- /task --- + +--- task --- + +Log in, using the account you just created. + +Now you're logged in and have your site set up, you can see the website by visiting your `http://localhost/wp-admin`. + +--- /task --- + + +### Friendly permalinks + +It's recommended that you change your permalink settings to make your URLs more friendly. + +--- task --- + +Log in to WordPress and go to the dashboard. + +--- /task --- + +--- task --- + +Tape **O** pour `Interdire la connexion root à distance`. + +--- /task --- + +--- task --- + +Select the **Post name** option and click **Save Changes**. + +--- /task --- + +--- task --- + +Type the following command in a terminal to enable Apache's `rewrite` mod: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo a2enmod rewrite + +--- /code --- + +--- /task --- + +--- task --- + +Open the Apache configuration file + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo geany /etc/apache2/sites-available/000-default.conf + +--- /code --- + +--- /task --- + +--- task --- + +Add the following lines after line 1. + +--- code --- +--- +language: sql line_numbers: true line_number_start: 2 +line_highlights: 3-5 +--- + AllowOverride All + +--- /code --- + +--- /task --- + +--- task --- + +Save the file and close Geany. + +--- /task --- + +--- task --- + +In a terminal type the command to restart Apache: + + + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo service apache2 restart + +--- /code --- + +--- /task --- \ No newline at end of file diff --git a/fr-FR/step_8.md b/fr-FR/step_8.md new file mode 100644 index 0000000..2e023a0 --- /dev/null +++ b/fr-FR/step_8.md @@ -0,0 +1,17 @@ +## Challenge + +--- challenge --- + +--- task --- + +Add more pages to your website. + +--- /task --- + +--- task --- + +Install a different theme from the Appearance menu. + +--- /task --- + +--- /challenge --- diff --git a/fr-FR/step_9.md b/fr-FR/step_9.md new file mode 100644 index 0000000..fc5847a --- /dev/null +++ b/fr-FR/step_9.md @@ -0,0 +1,3 @@ +## What can you do now? + +You could try setting up a [Python web server with Flask](https://projects.raspberrypi.org/en/projects/python-web-server-with-flask) \ No newline at end of file diff --git a/he-IL/images/Python-Webserver-with-Wordpress-TILE-01.png b/he-IL/images/Python-Webserver-with-Wordpress-TILE-01.png new file mode 100644 index 0000000..f632634 Binary files /dev/null and b/he-IL/images/Python-Webserver-with-Wordpress-TILE-01.png differ diff --git a/he-IL/images/Python-Webserver-with-Wordpress.png b/he-IL/images/Python-Webserver-with-Wordpress.png new file mode 100644 index 0000000..07b0191 Binary files /dev/null and b/he-IL/images/Python-Webserver-with-Wordpress.png differ diff --git a/he-IL/images/apache-hello-world.png b/he-IL/images/apache-hello-world.png new file mode 100644 index 0000000..69fb339 Binary files /dev/null and b/he-IL/images/apache-hello-world.png differ diff --git a/he-IL/images/apache-it-works.png b/he-IL/images/apache-it-works.png new file mode 100644 index 0000000..fb71d9f Binary files /dev/null and b/he-IL/images/apache-it-works.png differ diff --git a/he-IL/images/banner.png b/he-IL/images/banner.png new file mode 100644 index 0000000..88a7bfb Binary files /dev/null and b/he-IL/images/banner.png differ diff --git a/he-IL/images/create-database.png b/he-IL/images/create-database.png new file mode 100644 index 0000000..34c91f2 Binary files /dev/null and b/he-IL/images/create-database.png differ diff --git a/he-IL/images/hostname.png b/he-IL/images/hostname.png new file mode 100644 index 0000000..bb50249 Binary files /dev/null and b/he-IL/images/hostname.png differ diff --git a/he-IL/images/hostname_annotated.png b/he-IL/images/hostname_annotated.png new file mode 100644 index 0000000..27b2f08 Binary files /dev/null and b/he-IL/images/hostname_annotated.png differ diff --git a/he-IL/images/install_apache.png b/he-IL/images/install_apache.png new file mode 100644 index 0000000..8b5dab8 Binary files /dev/null and b/he-IL/images/install_apache.png differ diff --git a/he-IL/images/wordpress-database-setup.png b/he-IL/images/wordpress-database-setup.png new file mode 100644 index 0000000..a1b2a91 Binary files /dev/null and b/he-IL/images/wordpress-database-setup.png differ diff --git a/he-IL/images/wordpress-information_needed.png b/he-IL/images/wordpress-information_needed.png new file mode 100644 index 0000000..8119d0a Binary files /dev/null and b/he-IL/images/wordpress-information_needed.png differ diff --git a/he-IL/images/wordpress-run-installation.png b/he-IL/images/wordpress-run-installation.png new file mode 100644 index 0000000..b368d00 Binary files /dev/null and b/he-IL/images/wordpress-run-installation.png differ diff --git a/he-IL/images/wordpress-welcome.png b/he-IL/images/wordpress-welcome.png new file mode 100644 index 0000000..9394739 Binary files /dev/null and b/he-IL/images/wordpress-welcome.png differ diff --git a/he-IL/images/wordpress_language.png b/he-IL/images/wordpress_language.png new file mode 100644 index 0000000..4d44ba3 Binary files /dev/null and b/he-IL/images/wordpress_language.png differ diff --git a/he-IL/images/wp-info.png b/he-IL/images/wp-info.png new file mode 100644 index 0000000..032e62e Binary files /dev/null and b/he-IL/images/wp-info.png differ diff --git a/he-IL/meta.yml b/he-IL/meta.yml new file mode 100644 index 0000000..0fd5c62 --- /dev/null +++ b/he-IL/meta.yml @@ -0,0 +1,42 @@ +--- +title: Build a LAMP Web Server with WordPress +hero_image: images/banner.png +description: Set up a local server for a website on your Raspberry Pi +original_url: https://raspberrypi.org/learning/lamp-web-server-with-wordpress +theme: turquoise +duration: 2 +listed: true +ingredient: false +copyedit: false +curriculum: 3, design-0, programming-3, phys-comp-0, manufacture-0, community-0 +interests: '' +technologies: raspberry-pi, html-css-javascript +site_areas: פרויקטים +hardware: raspberry-pi +software: html-css-javascript +version: 4 +last_tested: 2017-01-01 +steps: + - + title: הקדמה + - + title: Set up an Apache web server + completion: + - engaged + - + title: Install PHP + - + title: Install MariaDB + - + title: Download WordPress + - + title: Set up your WordPress database + completion: + - internal + - + title: WordPress configuration + completion: + - external + - + title: Challenge + challenge: true diff --git a/he-IL/step_1.md b/he-IL/step_1.md new file mode 100644 index 0000000..ba29b28 --- /dev/null +++ b/he-IL/step_1.md @@ -0,0 +1,12 @@ +## התוצר +Learn to set up a LAMP (**L**inux, **A**pache, **M**ySQL, **P**HP) stack on your Raspberry Pi and configure it to work as a web server. + + - Install software on your Raspberry Pi + - Install and configure Apache, PHP, and MySQL to create a LAMP web server + - Download WordPress and run it as a local website on your Raspberry Pi + - Configure WordPress and make your website accessible to other devices on your local network + + +### You will need +- A Raspberry Pi computer connected to the internet +- [An up to date install of the Raspberry Pi OS](https://www.raspberrypi.org/downloads/) diff --git a/he-IL/step_2.md b/he-IL/step_2.md new file mode 100644 index 0000000..1cb6c47 --- /dev/null +++ b/he-IL/step_2.md @@ -0,0 +1,110 @@ +## Set up an Apache web server + +Apache is a popular web server application you can install on the Raspberry Pi to allow it to serve web pages. + +On its own, Apache can serve HTML files over HTTP. With additional modules it can serve dynamic web pages using scripting languages such as PHP. + +### Install Apache + +--- task --- + +Open a terminal window by selecting **Accessories** > **Terminal** from the menu. + +--- /task --- + +--- task --- + +Type the following command into the terminal and press Enter to install `apache2` + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo apt install apache2 -y + +--- /code --- + +**Tip:** If you see an error, make sure you are using the latest version of Raspberry Pi OS. + +--- /task --- + + +### Test the web server + +By default, Apache puts a test HTML file in the web folder that you will be able to view from your Pi or another computer on your network. + +--- task --- + +Open Chromium by selecting **Internet** > **Chromium Web Browser** from the menu. + +--- /task --- + +--- task --- + +Type `localhost` in the address bar. + +--- /task --- + +You should see this in your browser window: + +![Apache it works](images/apache-it-works.png) + +This means you have Apache working! + +### Changing the default web page + +This default web page is just a HTML file on the file system. It is located at `/var/www/html/index.html`. + +--- task --- + +Type the following command in the terminal to change to the directory containing the HTML file: + +--- code --- +--- +language: bash +line_numbers: false +--- +cd /var/www/html + +--- /code --- + +--- /task --- + +--- task --- + +Open the `index.html` file using Thonny + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo thonny index.html + +--- /code --- + +--- /task --- + +--- task --- + +Delete the contents of the file, then type a short message and save your changes. + +--- /task --- + +--- task --- + +Go back to Chromium and refresh the browser. You will see your message appear on the web page. + +--- /task --- + +--- collapse --- +--- +title: Access the page from another device on the network +--- + +You can open your web page from any other computer on your network, using the IP address of your Raspberry Pi, e.g. `http://192.168.1.10`. + +To find out your Raspberry Pi's IP address, type `hostname -I` into the terminal window. + +--- /collapse --- diff --git a/he-IL/step_3.md b/he-IL/step_3.md new file mode 100644 index 0000000..4bb6e7f --- /dev/null +++ b/he-IL/step_3.md @@ -0,0 +1,91 @@ +## Install PHP + +PHP is a **preprocessor**: it's code that runs when the server receives a request for a web page via a web browser. It works out what needs to be shown on the page, and then sends that page to the browser. + +--- task --- + +Type the following command in the terminal to install PHP: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo apt install php -y + +--- /code --- + +--- /task --- + +### Test PHP + +--- task --- + +Type this command to delete the `index.html` file from earlier: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo rm index.html + +--- /code --- + +--- /task --- + +--- task --- + +Create a new file called `index.php`: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo thonny index.php + +--- /code --- + +--- /task --- + +--- task --- + +In the Thonny code editor, type this PHP code into the file and save it. + +--- code --- +--- +language: php +line_numbers: false +--- + + +--- /code --- + +--- /task --- + +--- task --- + +Refresh your browser. You should see "hello world". This page is not dynamic, but it is still served by PHP. + +![hello world](images/apache-hello-world.png) + +--- /task --- + + +--- collapse --- +--- +title: I can only see PHP code +--- +If you see the raw PHP above instead of "hello world", use this command to reload and restart Apache: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo service apache2 restart + +--- /code --- + +--- /collapse --- diff --git a/he-IL/step_4.md b/he-IL/step_4.md new file mode 100644 index 0000000..cc6eae1 --- /dev/null +++ b/he-IL/step_4.md @@ -0,0 +1,75 @@ +## Install MariaDB + +MariaDB is a popular database engine. Like PHP, it's widely used on web servers, which is why projects like WordPress use it, and why those projects are so popular. + + +--- task --- + +Type this command to install the MariaDB Server and PHP-MySQL packages: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo apt install mariadb-server php-mysql -y + +--- /code --- + +--- /task --- + +--- task --- + +Now restart Apache: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo service apache2 restart + +--- /code --- + +--- /task --- + +### Set up + +--- task --- + +Run the MySQL secure installation command in the terminal window. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo mysql_secure_installation + +--- /code --- + +--- /task --- + +--- task --- + +Go through the setup wizard using the following answers: + ++ `Enter current password for root (enter for none):` — press **Enter**. + ++ `Switch to unix_socket authentication [Y/n]` - Type in **N** and press **Enter** + ++ `Change the root password?` - Type in **Y** and press **Enter** + ++ `New password:` - Type in a password and press **Enter**, then repeat a second time. **Important:** remember this root password, as you will need it later to set up WordPress. + ++ `Remove anonymous users` - Type in **Y** + ++ `Disallow root login remotely` - Type in **Y** + ++ `Remove test database and access to it` - Type in **Y** + ++ `Reload privilege tables now` - Type in **Y** + +--- /task --- + +When complete, you will see the message `All done!` and `Thanks for using MariaDB!`. diff --git a/he-IL/step_5.md b/he-IL/step_5.md new file mode 100644 index 0000000..d34db90 --- /dev/null +++ b/he-IL/step_5.md @@ -0,0 +1,109 @@ +## Download WordPress + +WordPress is a popular tool used to quickly create a website or blog with an easy to use editor for creating new content. + + +--- task --- + +In your terminal, make sure you are still in the directory `/var/www/html/` + +--- code --- +--- +language: bash +line_numbers: false +--- +cd /var/www/html/ + +--- /code --- + +--- /task --- + +--- task --- + +Delete all the files in the folder. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo rm * + +--- /code --- + +--- /task --- + +--- task --- + +Type this command to download WordPress + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo wget http://wordpress.org/latest.tar.gz + +--- /code --- + +--- /task --- + +--- task --- + +Extract the WordPress software: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo tar xzf latest.tar.gz + +--- /code --- + +--- /task --- + +--- task --- + +Move the contents of the extracted `wordpress` directory to the current directory. **Tip:** Make sure you type the whole command including the dot. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo mv wordpress/* . + +--- /code --- + +--- /task --- + +--- task --- + +Tidy up by removing the download, and the now empty `wordpress` directory. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo rm -rf wordpress latest.tar.gz + +--- /code --- + +--- /task --- + +---task --- + +Change the ownership of all these files to the Apache user: **Tip:** Make sure you type the whole command including the dot. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo chown -R www-data: . + +--- /code --- + +--- /task --- diff --git a/he-IL/step_6.md b/he-IL/step_6.md new file mode 100644 index 0000000..eefa5ec --- /dev/null +++ b/he-IL/step_6.md @@ -0,0 +1,95 @@ +## Set up your WordPress Database + +--- task --- + +Run `mysql` in the terminal window: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo mysql -uroot -p + +--- /code --- + +--- /task --- + +--- task --- + +Enter the root password you created when you set up the database. + +You will see the message `Welcome to the MariaDB monitor` and then the `MariaDB [(none)]>` prompt. + +--- /task --- + +--- task --- + +At the `MariaDB [(none)]>` prompt, type: **Tip:** Don't forget to type the semicolon at the end. + +--- code --- +--- +language: sql +line_numbers: false +--- +create database wordpress; + +--- /code --- + + + +--- /task --- + +If this has been successful, you should see `Query OK, 1 row affected (0.00 sec)`. + +--- task --- + +At the MariaDB prompt, grant database privileges to the root user. Change `YOURPASSWORD` to the password you created before. + +--- code --- +--- +language: sql +line_numbers: false +--- + +GRANT ALL PRIVILEGES ON wordpress.* TO 'root'@'localhost' IDENTIFIED BY 'YOURPASSWORD'; + +--- /code --- + +--- /task --- + +--- task --- + +For the changes to take effect, you will need to flush the database privileges: + +--- code --- +--- +language: sql +line_numbers: false +--- +FLUSH PRIVILEGES; + +--- /code --- + +--- /task --- + +--- task --- + +Exit the MariaDB prompt with Ctrl + D. + +--- /task --- + +--- task --- + +Restart your Raspberry Pi by typing this command in the terminal: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo reboot + +--- /code --- + +--- /task --- diff --git a/he-IL/step_7.md b/he-IL/step_7.md new file mode 100644 index 0000000..be18128 --- /dev/null +++ b/he-IL/step_7.md @@ -0,0 +1,155 @@ +## WordPress configuration + +--- task --- + +Once your Raspberry Pi has rebooted, open Chromium and type `localhost` into the address bar. + +You should see a WordPress page asking to pick your language. + +![WordPress select language](images/wordpress_language.png) + +--- /task --- + +--- task --- + +Select your language and click **Continue**. + +--- /task --- + +You will be presented with the WordPress welcome screen. + +![WordPress welcome screen](images/wordpress-welcome.png) + +--- task --- + +Click the **Let's go!** button. + +--- /task --- + +--- task --- + +Now fill out the basic site information as follows: **Tip:** Make sure you type `wordpress` in the first box as the text displayed is only a suggestion, the box is blank. + +``` +Database Name: wordpress +User Name: root +Password: +Database Host: localhost +Table Prefix: wp_ +``` + +Click **Submit** to proceed. + +--- /task --- + + +--- task --- + +Click the **Run the install** button. + +--- /task --- + +--- task --- + +Fill in the information you are asked for, then click the `Install WordPress` button. + +--- /task --- + +--- task --- + +Log in, using the account you just created. + +Now you're logged in and have your site set up, you can see the website by visiting your `http://localhost/wp-admin`. + +--- /task --- + + +### Friendly permalinks + +It's recommended that you change your permalink settings to make your URLs more friendly. + +--- task --- + +Log in to WordPress and go to the dashboard. + +--- /task --- + +--- task --- + +Go to **Setting**, then **Permalinks**. + +--- /task --- + +--- task --- + +Select the **Post name** option and click **Save Changes**. + +--- /task --- + +--- task --- + +Type the following command in a terminal to enable Apache's `rewrite` mod: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo a2enmod rewrite + +--- /code --- + +--- /task --- + +--- task --- + +Open the Apache configuration file + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo geany /etc/apache2/sites-available/000-default.conf + +--- /code --- + +--- /task --- + +--- task --- + +Add the following lines after line 1. + +--- code --- +--- +language: sql line_numbers: true line_number_start: 2 +line_highlights: 3-5 +--- + AllowOverride All + +--- /code --- + +--- /task --- + +--- task --- + +Save the file and close Geany. + +--- /task --- + +--- task --- + +In a terminal type the command to restart Apache: + + + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo service apache2 restart + +--- /code --- + +--- /task --- \ No newline at end of file diff --git a/he-IL/step_8.md b/he-IL/step_8.md new file mode 100644 index 0000000..2e023a0 --- /dev/null +++ b/he-IL/step_8.md @@ -0,0 +1,17 @@ +## Challenge + +--- challenge --- + +--- task --- + +Add more pages to your website. + +--- /task --- + +--- task --- + +Install a different theme from the Appearance menu. + +--- /task --- + +--- /challenge --- diff --git a/he-IL/step_9.md b/he-IL/step_9.md new file mode 100644 index 0000000..fc5847a --- /dev/null +++ b/he-IL/step_9.md @@ -0,0 +1,3 @@ +## What can you do now? + +You could try setting up a [Python web server with Flask](https://projects.raspberrypi.org/en/projects/python-web-server-with-flask) \ No newline at end of file diff --git a/hu-HU/images/Python-Webserver-with-Wordpress-TILE-01.png b/hu-HU/images/Python-Webserver-with-Wordpress-TILE-01.png new file mode 100644 index 0000000..f632634 Binary files /dev/null and b/hu-HU/images/Python-Webserver-with-Wordpress-TILE-01.png differ diff --git a/hu-HU/images/Python-Webserver-with-Wordpress.png b/hu-HU/images/Python-Webserver-with-Wordpress.png new file mode 100644 index 0000000..07b0191 Binary files /dev/null and b/hu-HU/images/Python-Webserver-with-Wordpress.png differ diff --git a/hu-HU/images/apache-hello-world.png b/hu-HU/images/apache-hello-world.png new file mode 100644 index 0000000..69fb339 Binary files /dev/null and b/hu-HU/images/apache-hello-world.png differ diff --git a/hu-HU/images/apache-it-works.png b/hu-HU/images/apache-it-works.png new file mode 100644 index 0000000..fb71d9f Binary files /dev/null and b/hu-HU/images/apache-it-works.png differ diff --git a/hu-HU/images/banner.png b/hu-HU/images/banner.png new file mode 100644 index 0000000..88a7bfb Binary files /dev/null and b/hu-HU/images/banner.png differ diff --git a/hu-HU/images/create-database.png b/hu-HU/images/create-database.png new file mode 100644 index 0000000..34c91f2 Binary files /dev/null and b/hu-HU/images/create-database.png differ diff --git a/hu-HU/images/hostname.png b/hu-HU/images/hostname.png new file mode 100644 index 0000000..bb50249 Binary files /dev/null and b/hu-HU/images/hostname.png differ diff --git a/hu-HU/images/hostname_annotated.png b/hu-HU/images/hostname_annotated.png new file mode 100644 index 0000000..27b2f08 Binary files /dev/null and b/hu-HU/images/hostname_annotated.png differ diff --git a/hu-HU/images/install_apache.png b/hu-HU/images/install_apache.png new file mode 100644 index 0000000..8b5dab8 Binary files /dev/null and b/hu-HU/images/install_apache.png differ diff --git a/hu-HU/images/wordpress-database-setup.png b/hu-HU/images/wordpress-database-setup.png new file mode 100644 index 0000000..a1b2a91 Binary files /dev/null and b/hu-HU/images/wordpress-database-setup.png differ diff --git a/hu-HU/images/wordpress-information_needed.png b/hu-HU/images/wordpress-information_needed.png new file mode 100644 index 0000000..8119d0a Binary files /dev/null and b/hu-HU/images/wordpress-information_needed.png differ diff --git a/hu-HU/images/wordpress-run-installation.png b/hu-HU/images/wordpress-run-installation.png new file mode 100644 index 0000000..b368d00 Binary files /dev/null and b/hu-HU/images/wordpress-run-installation.png differ diff --git a/hu-HU/images/wordpress-welcome.png b/hu-HU/images/wordpress-welcome.png new file mode 100644 index 0000000..9394739 Binary files /dev/null and b/hu-HU/images/wordpress-welcome.png differ diff --git a/hu-HU/images/wordpress_language.png b/hu-HU/images/wordpress_language.png new file mode 100644 index 0000000..4d44ba3 Binary files /dev/null and b/hu-HU/images/wordpress_language.png differ diff --git a/hu-HU/images/wp-info.png b/hu-HU/images/wp-info.png new file mode 100644 index 0000000..032e62e Binary files /dev/null and b/hu-HU/images/wp-info.png differ diff --git a/hu-HU/meta.yml b/hu-HU/meta.yml new file mode 100644 index 0000000..2ed0936 --- /dev/null +++ b/hu-HU/meta.yml @@ -0,0 +1,42 @@ +--- +title: Build a LAMP Web Server with WordPress +hero_image: images / banner.png +description: Set up a local server for a website on your Raspberry Pi +original_url: https://raspberrypi.org/learning/lamp-web-server-with-wordpress +theme: turquoise +duration: 2 +listed: true +ingredient: false +copyedit: false +curriculum: 3, design-0, programming-3, phys-comp-0, manufacture-0, community-0 +interests: '' +technologies: raspberry-pi, html-css-javascript +site_areas: projects +hardware: raspberry-pi +software: html-css-javascript +version: 4 +last_tested: 2017-01-01 +steps: + - + title: Bevezetés + - + title: Set up an Apache web server + completion: + - engaged + - + title: Install PHP + - + title: Install MariaDB + - + title: Download WordPress + - + title: Set up your WordPress database + completion: + - internal + - + title: WordPress configuration + completion: + - external + - + title: Challenge + challenge: true diff --git a/hu-HU/step_1.md b/hu-HU/step_1.md new file mode 100644 index 0000000..afa6b3c --- /dev/null +++ b/hu-HU/step_1.md @@ -0,0 +1,12 @@ +## Mit fogsz elkészíteni +Learn to set up a LAMP (**L**inux, **A**pache, **M**ySQL, **P**HP) stack on your Raspberry Pi and configure it to work as a web server. + + - Install software on your Raspberry Pi + - Install and configure Apache, PHP, and MySQL to create a LAMP web server + - Download WordPress and run it as a local website on your Raspberry Pi + - Configure WordPress and make your website accessible to other devices on your local network + + +### You will need +- A Raspberry Pi computer connected to the internet +- [An up to date install of the Raspberry Pi OS](https://www.raspberrypi.org/downloads/) diff --git a/hu-HU/step_2.md b/hu-HU/step_2.md new file mode 100644 index 0000000..1cb6c47 --- /dev/null +++ b/hu-HU/step_2.md @@ -0,0 +1,110 @@ +## Set up an Apache web server + +Apache is a popular web server application you can install on the Raspberry Pi to allow it to serve web pages. + +On its own, Apache can serve HTML files over HTTP. With additional modules it can serve dynamic web pages using scripting languages such as PHP. + +### Install Apache + +--- task --- + +Open a terminal window by selecting **Accessories** > **Terminal** from the menu. + +--- /task --- + +--- task --- + +Type the following command into the terminal and press Enter to install `apache2` + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo apt install apache2 -y + +--- /code --- + +**Tip:** If you see an error, make sure you are using the latest version of Raspberry Pi OS. + +--- /task --- + + +### Test the web server + +By default, Apache puts a test HTML file in the web folder that you will be able to view from your Pi or another computer on your network. + +--- task --- + +Open Chromium by selecting **Internet** > **Chromium Web Browser** from the menu. + +--- /task --- + +--- task --- + +Type `localhost` in the address bar. + +--- /task --- + +You should see this in your browser window: + +![Apache it works](images/apache-it-works.png) + +This means you have Apache working! + +### Changing the default web page + +This default web page is just a HTML file on the file system. It is located at `/var/www/html/index.html`. + +--- task --- + +Type the following command in the terminal to change to the directory containing the HTML file: + +--- code --- +--- +language: bash +line_numbers: false +--- +cd /var/www/html + +--- /code --- + +--- /task --- + +--- task --- + +Open the `index.html` file using Thonny + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo thonny index.html + +--- /code --- + +--- /task --- + +--- task --- + +Delete the contents of the file, then type a short message and save your changes. + +--- /task --- + +--- task --- + +Go back to Chromium and refresh the browser. You will see your message appear on the web page. + +--- /task --- + +--- collapse --- +--- +title: Access the page from another device on the network +--- + +You can open your web page from any other computer on your network, using the IP address of your Raspberry Pi, e.g. `http://192.168.1.10`. + +To find out your Raspberry Pi's IP address, type `hostname -I` into the terminal window. + +--- /collapse --- diff --git a/hu-HU/step_3.md b/hu-HU/step_3.md new file mode 100644 index 0000000..4bb6e7f --- /dev/null +++ b/hu-HU/step_3.md @@ -0,0 +1,91 @@ +## Install PHP + +PHP is a **preprocessor**: it's code that runs when the server receives a request for a web page via a web browser. It works out what needs to be shown on the page, and then sends that page to the browser. + +--- task --- + +Type the following command in the terminal to install PHP: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo apt install php -y + +--- /code --- + +--- /task --- + +### Test PHP + +--- task --- + +Type this command to delete the `index.html` file from earlier: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo rm index.html + +--- /code --- + +--- /task --- + +--- task --- + +Create a new file called `index.php`: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo thonny index.php + +--- /code --- + +--- /task --- + +--- task --- + +In the Thonny code editor, type this PHP code into the file and save it. + +--- code --- +--- +language: php +line_numbers: false +--- + + +--- /code --- + +--- /task --- + +--- task --- + +Refresh your browser. You should see "hello world". This page is not dynamic, but it is still served by PHP. + +![hello world](images/apache-hello-world.png) + +--- /task --- + + +--- collapse --- +--- +title: I can only see PHP code +--- +If you see the raw PHP above instead of "hello world", use this command to reload and restart Apache: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo service apache2 restart + +--- /code --- + +--- /collapse --- diff --git a/hu-HU/step_4.md b/hu-HU/step_4.md new file mode 100644 index 0000000..cc6eae1 --- /dev/null +++ b/hu-HU/step_4.md @@ -0,0 +1,75 @@ +## Install MariaDB + +MariaDB is a popular database engine. Like PHP, it's widely used on web servers, which is why projects like WordPress use it, and why those projects are so popular. + + +--- task --- + +Type this command to install the MariaDB Server and PHP-MySQL packages: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo apt install mariadb-server php-mysql -y + +--- /code --- + +--- /task --- + +--- task --- + +Now restart Apache: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo service apache2 restart + +--- /code --- + +--- /task --- + +### Set up + +--- task --- + +Run the MySQL secure installation command in the terminal window. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo mysql_secure_installation + +--- /code --- + +--- /task --- + +--- task --- + +Go through the setup wizard using the following answers: + ++ `Enter current password for root (enter for none):` — press **Enter**. + ++ `Switch to unix_socket authentication [Y/n]` - Type in **N** and press **Enter** + ++ `Change the root password?` - Type in **Y** and press **Enter** + ++ `New password:` - Type in a password and press **Enter**, then repeat a second time. **Important:** remember this root password, as you will need it later to set up WordPress. + ++ `Remove anonymous users` - Type in **Y** + ++ `Disallow root login remotely` - Type in **Y** + ++ `Remove test database and access to it` - Type in **Y** + ++ `Reload privilege tables now` - Type in **Y** + +--- /task --- + +When complete, you will see the message `All done!` and `Thanks for using MariaDB!`. diff --git a/hu-HU/step_5.md b/hu-HU/step_5.md new file mode 100644 index 0000000..d34db90 --- /dev/null +++ b/hu-HU/step_5.md @@ -0,0 +1,109 @@ +## Download WordPress + +WordPress is a popular tool used to quickly create a website or blog with an easy to use editor for creating new content. + + +--- task --- + +In your terminal, make sure you are still in the directory `/var/www/html/` + +--- code --- +--- +language: bash +line_numbers: false +--- +cd /var/www/html/ + +--- /code --- + +--- /task --- + +--- task --- + +Delete all the files in the folder. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo rm * + +--- /code --- + +--- /task --- + +--- task --- + +Type this command to download WordPress + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo wget http://wordpress.org/latest.tar.gz + +--- /code --- + +--- /task --- + +--- task --- + +Extract the WordPress software: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo tar xzf latest.tar.gz + +--- /code --- + +--- /task --- + +--- task --- + +Move the contents of the extracted `wordpress` directory to the current directory. **Tip:** Make sure you type the whole command including the dot. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo mv wordpress/* . + +--- /code --- + +--- /task --- + +--- task --- + +Tidy up by removing the download, and the now empty `wordpress` directory. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo rm -rf wordpress latest.tar.gz + +--- /code --- + +--- /task --- + +---task --- + +Change the ownership of all these files to the Apache user: **Tip:** Make sure you type the whole command including the dot. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo chown -R www-data: . + +--- /code --- + +--- /task --- diff --git a/hu-HU/step_6.md b/hu-HU/step_6.md new file mode 100644 index 0000000..eefa5ec --- /dev/null +++ b/hu-HU/step_6.md @@ -0,0 +1,95 @@ +## Set up your WordPress Database + +--- task --- + +Run `mysql` in the terminal window: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo mysql -uroot -p + +--- /code --- + +--- /task --- + +--- task --- + +Enter the root password you created when you set up the database. + +You will see the message `Welcome to the MariaDB monitor` and then the `MariaDB [(none)]>` prompt. + +--- /task --- + +--- task --- + +At the `MariaDB [(none)]>` prompt, type: **Tip:** Don't forget to type the semicolon at the end. + +--- code --- +--- +language: sql +line_numbers: false +--- +create database wordpress; + +--- /code --- + + + +--- /task --- + +If this has been successful, you should see `Query OK, 1 row affected (0.00 sec)`. + +--- task --- + +At the MariaDB prompt, grant database privileges to the root user. Change `YOURPASSWORD` to the password you created before. + +--- code --- +--- +language: sql +line_numbers: false +--- + +GRANT ALL PRIVILEGES ON wordpress.* TO 'root'@'localhost' IDENTIFIED BY 'YOURPASSWORD'; + +--- /code --- + +--- /task --- + +--- task --- + +For the changes to take effect, you will need to flush the database privileges: + +--- code --- +--- +language: sql +line_numbers: false +--- +FLUSH PRIVILEGES; + +--- /code --- + +--- /task --- + +--- task --- + +Exit the MariaDB prompt with Ctrl + D. + +--- /task --- + +--- task --- + +Restart your Raspberry Pi by typing this command in the terminal: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo reboot + +--- /code --- + +--- /task --- diff --git a/hu-HU/step_7.md b/hu-HU/step_7.md new file mode 100644 index 0000000..be18128 --- /dev/null +++ b/hu-HU/step_7.md @@ -0,0 +1,155 @@ +## WordPress configuration + +--- task --- + +Once your Raspberry Pi has rebooted, open Chromium and type `localhost` into the address bar. + +You should see a WordPress page asking to pick your language. + +![WordPress select language](images/wordpress_language.png) + +--- /task --- + +--- task --- + +Select your language and click **Continue**. + +--- /task --- + +You will be presented with the WordPress welcome screen. + +![WordPress welcome screen](images/wordpress-welcome.png) + +--- task --- + +Click the **Let's go!** button. + +--- /task --- + +--- task --- + +Now fill out the basic site information as follows: **Tip:** Make sure you type `wordpress` in the first box as the text displayed is only a suggestion, the box is blank. + +``` +Database Name: wordpress +User Name: root +Password: +Database Host: localhost +Table Prefix: wp_ +``` + +Click **Submit** to proceed. + +--- /task --- + + +--- task --- + +Click the **Run the install** button. + +--- /task --- + +--- task --- + +Fill in the information you are asked for, then click the `Install WordPress` button. + +--- /task --- + +--- task --- + +Log in, using the account you just created. + +Now you're logged in and have your site set up, you can see the website by visiting your `http://localhost/wp-admin`. + +--- /task --- + + +### Friendly permalinks + +It's recommended that you change your permalink settings to make your URLs more friendly. + +--- task --- + +Log in to WordPress and go to the dashboard. + +--- /task --- + +--- task --- + +Go to **Setting**, then **Permalinks**. + +--- /task --- + +--- task --- + +Select the **Post name** option and click **Save Changes**. + +--- /task --- + +--- task --- + +Type the following command in a terminal to enable Apache's `rewrite` mod: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo a2enmod rewrite + +--- /code --- + +--- /task --- + +--- task --- + +Open the Apache configuration file + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo geany /etc/apache2/sites-available/000-default.conf + +--- /code --- + +--- /task --- + +--- task --- + +Add the following lines after line 1. + +--- code --- +--- +language: sql line_numbers: true line_number_start: 2 +line_highlights: 3-5 +--- + AllowOverride All + +--- /code --- + +--- /task --- + +--- task --- + +Save the file and close Geany. + +--- /task --- + +--- task --- + +In a terminal type the command to restart Apache: + + + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo service apache2 restart + +--- /code --- + +--- /task --- \ No newline at end of file diff --git a/hu-HU/step_8.md b/hu-HU/step_8.md new file mode 100644 index 0000000..2e023a0 --- /dev/null +++ b/hu-HU/step_8.md @@ -0,0 +1,17 @@ +## Challenge + +--- challenge --- + +--- task --- + +Add more pages to your website. + +--- /task --- + +--- task --- + +Install a different theme from the Appearance menu. + +--- /task --- + +--- /challenge --- diff --git a/hu-HU/step_9.md b/hu-HU/step_9.md new file mode 100644 index 0000000..fc5847a --- /dev/null +++ b/hu-HU/step_9.md @@ -0,0 +1,3 @@ +## What can you do now? + +You could try setting up a [Python web server with Flask](https://projects.raspberrypi.org/en/projects/python-web-server-with-flask) \ No newline at end of file diff --git a/it-IT/images/Python-Webserver-with-Wordpress-TILE-01.png b/it-IT/images/Python-Webserver-with-Wordpress-TILE-01.png new file mode 100644 index 0000000..f632634 Binary files /dev/null and b/it-IT/images/Python-Webserver-with-Wordpress-TILE-01.png differ diff --git a/it-IT/images/Python-Webserver-with-Wordpress.png b/it-IT/images/Python-Webserver-with-Wordpress.png new file mode 100644 index 0000000..07b0191 Binary files /dev/null and b/it-IT/images/Python-Webserver-with-Wordpress.png differ diff --git a/it-IT/images/apache-hello-world.png b/it-IT/images/apache-hello-world.png new file mode 100644 index 0000000..da8c7e8 Binary files /dev/null and b/it-IT/images/apache-hello-world.png differ diff --git a/it-IT/images/apache-it-works.png b/it-IT/images/apache-it-works.png new file mode 100644 index 0000000..fb71d9f Binary files /dev/null and b/it-IT/images/apache-it-works.png differ diff --git a/it-IT/images/banner.png b/it-IT/images/banner.png new file mode 100644 index 0000000..88a7bfb Binary files /dev/null and b/it-IT/images/banner.png differ diff --git a/it-IT/images/create-database.png b/it-IT/images/create-database.png new file mode 100644 index 0000000..34c91f2 Binary files /dev/null and b/it-IT/images/create-database.png differ diff --git a/it-IT/images/hostname.png b/it-IT/images/hostname.png new file mode 100644 index 0000000..bb50249 Binary files /dev/null and b/it-IT/images/hostname.png differ diff --git a/it-IT/images/hostname_annotated.png b/it-IT/images/hostname_annotated.png new file mode 100644 index 0000000..27b2f08 Binary files /dev/null and b/it-IT/images/hostname_annotated.png differ diff --git a/it-IT/images/install_apache.png b/it-IT/images/install_apache.png new file mode 100644 index 0000000..8b5dab8 Binary files /dev/null and b/it-IT/images/install_apache.png differ diff --git a/it-IT/images/wordpress-database-setup.png b/it-IT/images/wordpress-database-setup.png new file mode 100644 index 0000000..a1b2a91 Binary files /dev/null and b/it-IT/images/wordpress-database-setup.png differ diff --git a/it-IT/images/wordpress-information_needed.png b/it-IT/images/wordpress-information_needed.png new file mode 100644 index 0000000..8119d0a Binary files /dev/null and b/it-IT/images/wordpress-information_needed.png differ diff --git a/it-IT/images/wordpress-run-installation.png b/it-IT/images/wordpress-run-installation.png new file mode 100644 index 0000000..b368d00 Binary files /dev/null and b/it-IT/images/wordpress-run-installation.png differ diff --git a/it-IT/images/wordpress-welcome.png b/it-IT/images/wordpress-welcome.png new file mode 100644 index 0000000..9394739 Binary files /dev/null and b/it-IT/images/wordpress-welcome.png differ diff --git a/it-IT/images/wordpress_language.png b/it-IT/images/wordpress_language.png new file mode 100644 index 0000000..4d44ba3 Binary files /dev/null and b/it-IT/images/wordpress_language.png differ diff --git a/it-IT/images/wp-info.png b/it-IT/images/wp-info.png new file mode 100644 index 0000000..032e62e Binary files /dev/null and b/it-IT/images/wp-info.png differ diff --git a/it-IT/meta.yml b/it-IT/meta.yml new file mode 100644 index 0000000..4f6dc78 --- /dev/null +++ b/it-IT/meta.yml @@ -0,0 +1,42 @@ +--- +title: Costruisci un server Web LAMP con WordPress +hero_image: images/banner.png +description: Configura un server locale per un sito Web sul tuo Raspberry Pi +original_url: https://raspberrypi.org/learning/lamp-web-server-with-wordpress +theme: turquoise +duration: 2 +listed: true +ingredient: false +copyedit: false +curriculum: 3, design-0, programming-3, phys-comp-0, manufacture-0, community-0 +interests: '' +technologies: raspberry-pi, html-css-javascript +site_areas: projects +hardware: raspberry-pi +software: html-css-javascript +version: 4 +last_tested: 2017-01-01 +steps: + - + title: Introduzione + - + title: Set up an Apache web server + completion: + - engaged + - + title: Install PHP + - + title: Install MariaDB + - + title: Download WordPress + - + title: Set up your WordPress database + completion: + - internal + - + title: WordPress configuration + completion: + - external + - + title: Challenge + challenge: true diff --git a/it-IT/step_1.md b/it-IT/step_1.md new file mode 100644 index 0000000..af221c9 --- /dev/null +++ b/it-IT/step_1.md @@ -0,0 +1,12 @@ +## Che cosa creerai +Learn to set up a LAMP (**L**inux, **A**pache, **M**ySQL, **P**HP) stack on your Raspberry Pi and configure it to work as a web server. + + - Ad installare software sul tuo Raspberry Pi + - Ad installare e configurare Apache, PHP e MySQL per creare un server web LAMP + - A scaricare WordPress e ad usarlo come sito Web locale sul tuo Raspberry Pi + - A configurare WordPress e a rendere il tuo sito web accessibile da altri dispositivi sulla rete locale + + +### You will need +- A Raspberry Pi computer connected to the internet +- [An up to date install of the Raspberry Pi OS](https://www.raspberrypi.org/downloads/) diff --git a/it-IT/step_2.md b/it-IT/step_2.md new file mode 100644 index 0000000..1cb6c47 --- /dev/null +++ b/it-IT/step_2.md @@ -0,0 +1,110 @@ +## Set up an Apache web server + +Apache is a popular web server application you can install on the Raspberry Pi to allow it to serve web pages. + +On its own, Apache can serve HTML files over HTTP. With additional modules it can serve dynamic web pages using scripting languages such as PHP. + +### Install Apache + +--- task --- + +Open a terminal window by selecting **Accessories** > **Terminal** from the menu. + +--- /task --- + +--- task --- + +Type the following command into the terminal and press Enter to install `apache2` + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo apt install apache2 -y + +--- /code --- + +**Tip:** If you see an error, make sure you are using the latest version of Raspberry Pi OS. + +--- /task --- + + +### Test the web server + +By default, Apache puts a test HTML file in the web folder that you will be able to view from your Pi or another computer on your network. + +--- task --- + +Open Chromium by selecting **Internet** > **Chromium Web Browser** from the menu. + +--- /task --- + +--- task --- + +Type `localhost` in the address bar. + +--- /task --- + +You should see this in your browser window: + +![Apache it works](images/apache-it-works.png) + +This means you have Apache working! + +### Changing the default web page + +This default web page is just a HTML file on the file system. It is located at `/var/www/html/index.html`. + +--- task --- + +Type the following command in the terminal to change to the directory containing the HTML file: + +--- code --- +--- +language: bash +line_numbers: false +--- +cd /var/www/html + +--- /code --- + +--- /task --- + +--- task --- + +Open the `index.html` file using Thonny + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo thonny index.html + +--- /code --- + +--- /task --- + +--- task --- + +Delete the contents of the file, then type a short message and save your changes. + +--- /task --- + +--- task --- + +Go back to Chromium and refresh the browser. You will see your message appear on the web page. + +--- /task --- + +--- collapse --- +--- +title: Access the page from another device on the network +--- + +You can open your web page from any other computer on your network, using the IP address of your Raspberry Pi, e.g. `http://192.168.1.10`. + +To find out your Raspberry Pi's IP address, type `hostname -I` into the terminal window. + +--- /collapse --- diff --git a/it-IT/step_3.md b/it-IT/step_3.md new file mode 100644 index 0000000..4bb6e7f --- /dev/null +++ b/it-IT/step_3.md @@ -0,0 +1,91 @@ +## Install PHP + +PHP is a **preprocessor**: it's code that runs when the server receives a request for a web page via a web browser. It works out what needs to be shown on the page, and then sends that page to the browser. + +--- task --- + +Type the following command in the terminal to install PHP: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo apt install php -y + +--- /code --- + +--- /task --- + +### Test PHP + +--- task --- + +Type this command to delete the `index.html` file from earlier: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo rm index.html + +--- /code --- + +--- /task --- + +--- task --- + +Create a new file called `index.php`: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo thonny index.php + +--- /code --- + +--- /task --- + +--- task --- + +In the Thonny code editor, type this PHP code into the file and save it. + +--- code --- +--- +language: php +line_numbers: false +--- + + +--- /code --- + +--- /task --- + +--- task --- + +Refresh your browser. You should see "hello world". This page is not dynamic, but it is still served by PHP. + +![hello world](images/apache-hello-world.png) + +--- /task --- + + +--- collapse --- +--- +title: I can only see PHP code +--- +If you see the raw PHP above instead of "hello world", use this command to reload and restart Apache: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo service apache2 restart + +--- /code --- + +--- /collapse --- diff --git a/it-IT/step_4.md b/it-IT/step_4.md new file mode 100644 index 0000000..cc6eae1 --- /dev/null +++ b/it-IT/step_4.md @@ -0,0 +1,75 @@ +## Install MariaDB + +MariaDB is a popular database engine. Like PHP, it's widely used on web servers, which is why projects like WordPress use it, and why those projects are so popular. + + +--- task --- + +Type this command to install the MariaDB Server and PHP-MySQL packages: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo apt install mariadb-server php-mysql -y + +--- /code --- + +--- /task --- + +--- task --- + +Now restart Apache: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo service apache2 restart + +--- /code --- + +--- /task --- + +### Set up + +--- task --- + +Run the MySQL secure installation command in the terminal window. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo mysql_secure_installation + +--- /code --- + +--- /task --- + +--- task --- + +Go through the setup wizard using the following answers: + ++ `Enter current password for root (enter for none):` — press **Enter**. + ++ `Switch to unix_socket authentication [Y/n]` - Type in **N** and press **Enter** + ++ `Change the root password?` - Type in **Y** and press **Enter** + ++ `New password:` - Type in a password and press **Enter**, then repeat a second time. **Important:** remember this root password, as you will need it later to set up WordPress. + ++ `Remove anonymous users` - Type in **Y** + ++ `Disallow root login remotely` - Type in **Y** + ++ `Remove test database and access to it` - Type in **Y** + ++ `Reload privilege tables now` - Type in **Y** + +--- /task --- + +When complete, you will see the message `All done!` and `Thanks for using MariaDB!`. diff --git a/it-IT/step_5.md b/it-IT/step_5.md new file mode 100644 index 0000000..d34db90 --- /dev/null +++ b/it-IT/step_5.md @@ -0,0 +1,109 @@ +## Download WordPress + +WordPress is a popular tool used to quickly create a website or blog with an easy to use editor for creating new content. + + +--- task --- + +In your terminal, make sure you are still in the directory `/var/www/html/` + +--- code --- +--- +language: bash +line_numbers: false +--- +cd /var/www/html/ + +--- /code --- + +--- /task --- + +--- task --- + +Delete all the files in the folder. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo rm * + +--- /code --- + +--- /task --- + +--- task --- + +Type this command to download WordPress + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo wget http://wordpress.org/latest.tar.gz + +--- /code --- + +--- /task --- + +--- task --- + +Extract the WordPress software: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo tar xzf latest.tar.gz + +--- /code --- + +--- /task --- + +--- task --- + +Move the contents of the extracted `wordpress` directory to the current directory. **Tip:** Make sure you type the whole command including the dot. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo mv wordpress/* . + +--- /code --- + +--- /task --- + +--- task --- + +Tidy up by removing the download, and the now empty `wordpress` directory. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo rm -rf wordpress latest.tar.gz + +--- /code --- + +--- /task --- + +---task --- + +Change the ownership of all these files to the Apache user: **Tip:** Make sure you type the whole command including the dot. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo chown -R www-data: . + +--- /code --- + +--- /task --- diff --git a/it-IT/step_6.md b/it-IT/step_6.md new file mode 100644 index 0000000..eefa5ec --- /dev/null +++ b/it-IT/step_6.md @@ -0,0 +1,95 @@ +## Set up your WordPress Database + +--- task --- + +Run `mysql` in the terminal window: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo mysql -uroot -p + +--- /code --- + +--- /task --- + +--- task --- + +Enter the root password you created when you set up the database. + +You will see the message `Welcome to the MariaDB monitor` and then the `MariaDB [(none)]>` prompt. + +--- /task --- + +--- task --- + +At the `MariaDB [(none)]>` prompt, type: **Tip:** Don't forget to type the semicolon at the end. + +--- code --- +--- +language: sql +line_numbers: false +--- +create database wordpress; + +--- /code --- + + + +--- /task --- + +If this has been successful, you should see `Query OK, 1 row affected (0.00 sec)`. + +--- task --- + +At the MariaDB prompt, grant database privileges to the root user. Change `YOURPASSWORD` to the password you created before. + +--- code --- +--- +language: sql +line_numbers: false +--- + +GRANT ALL PRIVILEGES ON wordpress.* TO 'root'@'localhost' IDENTIFIED BY 'YOURPASSWORD'; + +--- /code --- + +--- /task --- + +--- task --- + +For the changes to take effect, you will need to flush the database privileges: + +--- code --- +--- +language: sql +line_numbers: false +--- +FLUSH PRIVILEGES; + +--- /code --- + +--- /task --- + +--- task --- + +Exit the MariaDB prompt with Ctrl + D. + +--- /task --- + +--- task --- + +Restart your Raspberry Pi by typing this command in the terminal: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo reboot + +--- /code --- + +--- /task --- diff --git a/it-IT/step_7.md b/it-IT/step_7.md new file mode 100644 index 0000000..be18128 --- /dev/null +++ b/it-IT/step_7.md @@ -0,0 +1,155 @@ +## WordPress configuration + +--- task --- + +Once your Raspberry Pi has rebooted, open Chromium and type `localhost` into the address bar. + +You should see a WordPress page asking to pick your language. + +![WordPress select language](images/wordpress_language.png) + +--- /task --- + +--- task --- + +Select your language and click **Continue**. + +--- /task --- + +You will be presented with the WordPress welcome screen. + +![WordPress welcome screen](images/wordpress-welcome.png) + +--- task --- + +Click the **Let's go!** button. + +--- /task --- + +--- task --- + +Now fill out the basic site information as follows: **Tip:** Make sure you type `wordpress` in the first box as the text displayed is only a suggestion, the box is blank. + +``` +Database Name: wordpress +User Name: root +Password: +Database Host: localhost +Table Prefix: wp_ +``` + +Click **Submit** to proceed. + +--- /task --- + + +--- task --- + +Click the **Run the install** button. + +--- /task --- + +--- task --- + +Fill in the information you are asked for, then click the `Install WordPress` button. + +--- /task --- + +--- task --- + +Log in, using the account you just created. + +Now you're logged in and have your site set up, you can see the website by visiting your `http://localhost/wp-admin`. + +--- /task --- + + +### Friendly permalinks + +It's recommended that you change your permalink settings to make your URLs more friendly. + +--- task --- + +Log in to WordPress and go to the dashboard. + +--- /task --- + +--- task --- + +Go to **Setting**, then **Permalinks**. + +--- /task --- + +--- task --- + +Select the **Post name** option and click **Save Changes**. + +--- /task --- + +--- task --- + +Type the following command in a terminal to enable Apache's `rewrite` mod: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo a2enmod rewrite + +--- /code --- + +--- /task --- + +--- task --- + +Open the Apache configuration file + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo geany /etc/apache2/sites-available/000-default.conf + +--- /code --- + +--- /task --- + +--- task --- + +Add the following lines after line 1. + +--- code --- +--- +language: sql line_numbers: true line_number_start: 2 +line_highlights: 3-5 +--- + AllowOverride All + +--- /code --- + +--- /task --- + +--- task --- + +Save the file and close Geany. + +--- /task --- + +--- task --- + +In a terminal type the command to restart Apache: + + + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo service apache2 restart + +--- /code --- + +--- /task --- \ No newline at end of file diff --git a/it-IT/step_8.md b/it-IT/step_8.md new file mode 100644 index 0000000..2e023a0 --- /dev/null +++ b/it-IT/step_8.md @@ -0,0 +1,17 @@ +## Challenge + +--- challenge --- + +--- task --- + +Add more pages to your website. + +--- /task --- + +--- task --- + +Install a different theme from the Appearance menu. + +--- /task --- + +--- /challenge --- diff --git a/it-IT/step_9.md b/it-IT/step_9.md new file mode 100644 index 0000000..fc5847a --- /dev/null +++ b/it-IT/step_9.md @@ -0,0 +1,3 @@ +## What can you do now? + +You could try setting up a [Python web server with Flask](https://projects.raspberrypi.org/en/projects/python-web-server-with-flask) \ No newline at end of file diff --git a/ja-JP/images/Python-Webserver-with-Wordpress-TILE-01.png b/ja-JP/images/Python-Webserver-with-Wordpress-TILE-01.png new file mode 100644 index 0000000..f632634 Binary files /dev/null and b/ja-JP/images/Python-Webserver-with-Wordpress-TILE-01.png differ diff --git a/ja-JP/images/Python-Webserver-with-Wordpress.png b/ja-JP/images/Python-Webserver-with-Wordpress.png new file mode 100644 index 0000000..07b0191 Binary files /dev/null and b/ja-JP/images/Python-Webserver-with-Wordpress.png differ diff --git a/ja-JP/images/apache-hello-world.png b/ja-JP/images/apache-hello-world.png new file mode 100644 index 0000000..69fb339 Binary files /dev/null and b/ja-JP/images/apache-hello-world.png differ diff --git a/ja-JP/images/apache-it-works.png b/ja-JP/images/apache-it-works.png new file mode 100644 index 0000000..fb71d9f Binary files /dev/null and b/ja-JP/images/apache-it-works.png differ diff --git a/ja-JP/images/banner.png b/ja-JP/images/banner.png new file mode 100644 index 0000000..88a7bfb Binary files /dev/null and b/ja-JP/images/banner.png differ diff --git a/ja-JP/images/create-database.png b/ja-JP/images/create-database.png new file mode 100644 index 0000000..34c91f2 Binary files /dev/null and b/ja-JP/images/create-database.png differ diff --git a/ja-JP/images/hostname.png b/ja-JP/images/hostname.png new file mode 100644 index 0000000..bb50249 Binary files /dev/null and b/ja-JP/images/hostname.png differ diff --git a/ja-JP/images/hostname_annotated.png b/ja-JP/images/hostname_annotated.png new file mode 100644 index 0000000..27b2f08 Binary files /dev/null and b/ja-JP/images/hostname_annotated.png differ diff --git a/ja-JP/images/install_apache.png b/ja-JP/images/install_apache.png new file mode 100644 index 0000000..8b5dab8 Binary files /dev/null and b/ja-JP/images/install_apache.png differ diff --git a/ja-JP/images/wordpress-database-setup.png b/ja-JP/images/wordpress-database-setup.png new file mode 100644 index 0000000..a1b2a91 Binary files /dev/null and b/ja-JP/images/wordpress-database-setup.png differ diff --git a/ja-JP/images/wordpress-information_needed.png b/ja-JP/images/wordpress-information_needed.png new file mode 100644 index 0000000..8119d0a Binary files /dev/null and b/ja-JP/images/wordpress-information_needed.png differ diff --git a/ja-JP/images/wordpress-run-installation.png b/ja-JP/images/wordpress-run-installation.png new file mode 100644 index 0000000..b368d00 Binary files /dev/null and b/ja-JP/images/wordpress-run-installation.png differ diff --git a/ja-JP/images/wordpress-welcome.png b/ja-JP/images/wordpress-welcome.png new file mode 100644 index 0000000..9394739 Binary files /dev/null and b/ja-JP/images/wordpress-welcome.png differ diff --git a/ja-JP/images/wordpress_language.png b/ja-JP/images/wordpress_language.png new file mode 100644 index 0000000..4d44ba3 Binary files /dev/null and b/ja-JP/images/wordpress_language.png differ diff --git a/ja-JP/images/wp-info.png b/ja-JP/images/wp-info.png new file mode 100644 index 0000000..032e62e Binary files /dev/null and b/ja-JP/images/wp-info.png differ diff --git a/ja-JP/meta.yml b/ja-JP/meta.yml new file mode 100644 index 0000000..0cf5c25 --- /dev/null +++ b/ja-JP/meta.yml @@ -0,0 +1,42 @@ +--- +title: Build a LAMP Web Server with WordPress +hero_image: images/banner.png +description: Set up a local server for a website on your Raspberry Pi +original_url: https://raspberrypi.org/learning/lamp-web-server-with-wordpress +theme: turquoise +duration: 2 +listed: true +ingredient: false +copyedit: false +curriculum: 3, design-0, programming-3, phys-comp-0, manufacture-0, community-0 +interests: '' +technologies: raspberry-pi, html-css-javascript +site_areas: projects +hardware: raspberry-pi +software: html-css-javascript +version: 4 +last_tested: 2017-01-01 +steps: + - + title: 前書き + - + title: Set up an Apache web server + completion: + - engaged + - + title: Install PHP + - + title: Install MariaDB + - + title: Download WordPress + - + title: Set up your WordPress database + completion: + - internal + - + title: WordPress configuration + completion: + - external + - + title: Challenge + challenge: true diff --git a/ja-JP/step_1.md b/ja-JP/step_1.md new file mode 100644 index 0000000..bf498e5 --- /dev/null +++ b/ja-JP/step_1.md @@ -0,0 +1,12 @@ +## 作るもの +Learn to set up a LAMP (**L**inux, **A**pache, **M**ySQL, **P**HP) stack on your Raspberry Pi and configure it to work as a web server. + + - Install software on your Raspberry Pi + - Install and configure Apache, PHP, and MySQL to create a LAMP web server + - Download WordPress and run it as a local website on your Raspberry Pi + - Configure WordPress and make your website accessible to other devices on your local network + + +### You will need +- A Raspberry Pi computer connected to the internet +- [An up to date install of the Raspberry Pi OS](https://www.raspberrypi.org/downloads/) diff --git a/ja-JP/step_2.md b/ja-JP/step_2.md new file mode 100644 index 0000000..1cb6c47 --- /dev/null +++ b/ja-JP/step_2.md @@ -0,0 +1,110 @@ +## Set up an Apache web server + +Apache is a popular web server application you can install on the Raspberry Pi to allow it to serve web pages. + +On its own, Apache can serve HTML files over HTTP. With additional modules it can serve dynamic web pages using scripting languages such as PHP. + +### Install Apache + +--- task --- + +Open a terminal window by selecting **Accessories** > **Terminal** from the menu. + +--- /task --- + +--- task --- + +Type the following command into the terminal and press Enter to install `apache2` + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo apt install apache2 -y + +--- /code --- + +**Tip:** If you see an error, make sure you are using the latest version of Raspberry Pi OS. + +--- /task --- + + +### Test the web server + +By default, Apache puts a test HTML file in the web folder that you will be able to view from your Pi or another computer on your network. + +--- task --- + +Open Chromium by selecting **Internet** > **Chromium Web Browser** from the menu. + +--- /task --- + +--- task --- + +Type `localhost` in the address bar. + +--- /task --- + +You should see this in your browser window: + +![Apache it works](images/apache-it-works.png) + +This means you have Apache working! + +### Changing the default web page + +This default web page is just a HTML file on the file system. It is located at `/var/www/html/index.html`. + +--- task --- + +Type the following command in the terminal to change to the directory containing the HTML file: + +--- code --- +--- +language: bash +line_numbers: false +--- +cd /var/www/html + +--- /code --- + +--- /task --- + +--- task --- + +Open the `index.html` file using Thonny + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo thonny index.html + +--- /code --- + +--- /task --- + +--- task --- + +Delete the contents of the file, then type a short message and save your changes. + +--- /task --- + +--- task --- + +Go back to Chromium and refresh the browser. You will see your message appear on the web page. + +--- /task --- + +--- collapse --- +--- +title: Access the page from another device on the network +--- + +You can open your web page from any other computer on your network, using the IP address of your Raspberry Pi, e.g. `http://192.168.1.10`. + +To find out your Raspberry Pi's IP address, type `hostname -I` into the terminal window. + +--- /collapse --- diff --git a/ja-JP/step_3.md b/ja-JP/step_3.md new file mode 100644 index 0000000..4bb6e7f --- /dev/null +++ b/ja-JP/step_3.md @@ -0,0 +1,91 @@ +## Install PHP + +PHP is a **preprocessor**: it's code that runs when the server receives a request for a web page via a web browser. It works out what needs to be shown on the page, and then sends that page to the browser. + +--- task --- + +Type the following command in the terminal to install PHP: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo apt install php -y + +--- /code --- + +--- /task --- + +### Test PHP + +--- task --- + +Type this command to delete the `index.html` file from earlier: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo rm index.html + +--- /code --- + +--- /task --- + +--- task --- + +Create a new file called `index.php`: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo thonny index.php + +--- /code --- + +--- /task --- + +--- task --- + +In the Thonny code editor, type this PHP code into the file and save it. + +--- code --- +--- +language: php +line_numbers: false +--- + + +--- /code --- + +--- /task --- + +--- task --- + +Refresh your browser. You should see "hello world". This page is not dynamic, but it is still served by PHP. + +![hello world](images/apache-hello-world.png) + +--- /task --- + + +--- collapse --- +--- +title: I can only see PHP code +--- +If you see the raw PHP above instead of "hello world", use this command to reload and restart Apache: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo service apache2 restart + +--- /code --- + +--- /collapse --- diff --git a/ja-JP/step_4.md b/ja-JP/step_4.md new file mode 100644 index 0000000..cc6eae1 --- /dev/null +++ b/ja-JP/step_4.md @@ -0,0 +1,75 @@ +## Install MariaDB + +MariaDB is a popular database engine. Like PHP, it's widely used on web servers, which is why projects like WordPress use it, and why those projects are so popular. + + +--- task --- + +Type this command to install the MariaDB Server and PHP-MySQL packages: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo apt install mariadb-server php-mysql -y + +--- /code --- + +--- /task --- + +--- task --- + +Now restart Apache: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo service apache2 restart + +--- /code --- + +--- /task --- + +### Set up + +--- task --- + +Run the MySQL secure installation command in the terminal window. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo mysql_secure_installation + +--- /code --- + +--- /task --- + +--- task --- + +Go through the setup wizard using the following answers: + ++ `Enter current password for root (enter for none):` — press **Enter**. + ++ `Switch to unix_socket authentication [Y/n]` - Type in **N** and press **Enter** + ++ `Change the root password?` - Type in **Y** and press **Enter** + ++ `New password:` - Type in a password and press **Enter**, then repeat a second time. **Important:** remember this root password, as you will need it later to set up WordPress. + ++ `Remove anonymous users` - Type in **Y** + ++ `Disallow root login remotely` - Type in **Y** + ++ `Remove test database and access to it` - Type in **Y** + ++ `Reload privilege tables now` - Type in **Y** + +--- /task --- + +When complete, you will see the message `All done!` and `Thanks for using MariaDB!`. diff --git a/ja-JP/step_5.md b/ja-JP/step_5.md new file mode 100644 index 0000000..d34db90 --- /dev/null +++ b/ja-JP/step_5.md @@ -0,0 +1,109 @@ +## Download WordPress + +WordPress is a popular tool used to quickly create a website or blog with an easy to use editor for creating new content. + + +--- task --- + +In your terminal, make sure you are still in the directory `/var/www/html/` + +--- code --- +--- +language: bash +line_numbers: false +--- +cd /var/www/html/ + +--- /code --- + +--- /task --- + +--- task --- + +Delete all the files in the folder. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo rm * + +--- /code --- + +--- /task --- + +--- task --- + +Type this command to download WordPress + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo wget http://wordpress.org/latest.tar.gz + +--- /code --- + +--- /task --- + +--- task --- + +Extract the WordPress software: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo tar xzf latest.tar.gz + +--- /code --- + +--- /task --- + +--- task --- + +Move the contents of the extracted `wordpress` directory to the current directory. **Tip:** Make sure you type the whole command including the dot. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo mv wordpress/* . + +--- /code --- + +--- /task --- + +--- task --- + +Tidy up by removing the download, and the now empty `wordpress` directory. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo rm -rf wordpress latest.tar.gz + +--- /code --- + +--- /task --- + +---task --- + +Change the ownership of all these files to the Apache user: **Tip:** Make sure you type the whole command including the dot. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo chown -R www-data: . + +--- /code --- + +--- /task --- diff --git a/ja-JP/step_6.md b/ja-JP/step_6.md new file mode 100644 index 0000000..eefa5ec --- /dev/null +++ b/ja-JP/step_6.md @@ -0,0 +1,95 @@ +## Set up your WordPress Database + +--- task --- + +Run `mysql` in the terminal window: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo mysql -uroot -p + +--- /code --- + +--- /task --- + +--- task --- + +Enter the root password you created when you set up the database. + +You will see the message `Welcome to the MariaDB monitor` and then the `MariaDB [(none)]>` prompt. + +--- /task --- + +--- task --- + +At the `MariaDB [(none)]>` prompt, type: **Tip:** Don't forget to type the semicolon at the end. + +--- code --- +--- +language: sql +line_numbers: false +--- +create database wordpress; + +--- /code --- + + + +--- /task --- + +If this has been successful, you should see `Query OK, 1 row affected (0.00 sec)`. + +--- task --- + +At the MariaDB prompt, grant database privileges to the root user. Change `YOURPASSWORD` to the password you created before. + +--- code --- +--- +language: sql +line_numbers: false +--- + +GRANT ALL PRIVILEGES ON wordpress.* TO 'root'@'localhost' IDENTIFIED BY 'YOURPASSWORD'; + +--- /code --- + +--- /task --- + +--- task --- + +For the changes to take effect, you will need to flush the database privileges: + +--- code --- +--- +language: sql +line_numbers: false +--- +FLUSH PRIVILEGES; + +--- /code --- + +--- /task --- + +--- task --- + +Exit the MariaDB prompt with Ctrl + D. + +--- /task --- + +--- task --- + +Restart your Raspberry Pi by typing this command in the terminal: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo reboot + +--- /code --- + +--- /task --- diff --git a/ja-JP/step_7.md b/ja-JP/step_7.md new file mode 100644 index 0000000..be18128 --- /dev/null +++ b/ja-JP/step_7.md @@ -0,0 +1,155 @@ +## WordPress configuration + +--- task --- + +Once your Raspberry Pi has rebooted, open Chromium and type `localhost` into the address bar. + +You should see a WordPress page asking to pick your language. + +![WordPress select language](images/wordpress_language.png) + +--- /task --- + +--- task --- + +Select your language and click **Continue**. + +--- /task --- + +You will be presented with the WordPress welcome screen. + +![WordPress welcome screen](images/wordpress-welcome.png) + +--- task --- + +Click the **Let's go!** button. + +--- /task --- + +--- task --- + +Now fill out the basic site information as follows: **Tip:** Make sure you type `wordpress` in the first box as the text displayed is only a suggestion, the box is blank. + +``` +Database Name: wordpress +User Name: root +Password: +Database Host: localhost +Table Prefix: wp_ +``` + +Click **Submit** to proceed. + +--- /task --- + + +--- task --- + +Click the **Run the install** button. + +--- /task --- + +--- task --- + +Fill in the information you are asked for, then click the `Install WordPress` button. + +--- /task --- + +--- task --- + +Log in, using the account you just created. + +Now you're logged in and have your site set up, you can see the website by visiting your `http://localhost/wp-admin`. + +--- /task --- + + +### Friendly permalinks + +It's recommended that you change your permalink settings to make your URLs more friendly. + +--- task --- + +Log in to WordPress and go to the dashboard. + +--- /task --- + +--- task --- + +Go to **Setting**, then **Permalinks**. + +--- /task --- + +--- task --- + +Select the **Post name** option and click **Save Changes**. + +--- /task --- + +--- task --- + +Type the following command in a terminal to enable Apache's `rewrite` mod: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo a2enmod rewrite + +--- /code --- + +--- /task --- + +--- task --- + +Open the Apache configuration file + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo geany /etc/apache2/sites-available/000-default.conf + +--- /code --- + +--- /task --- + +--- task --- + +Add the following lines after line 1. + +--- code --- +--- +language: sql line_numbers: true line_number_start: 2 +line_highlights: 3-5 +--- + AllowOverride All + +--- /code --- + +--- /task --- + +--- task --- + +Save the file and close Geany. + +--- /task --- + +--- task --- + +In a terminal type the command to restart Apache: + + + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo service apache2 restart + +--- /code --- + +--- /task --- \ No newline at end of file diff --git a/ja-JP/step_8.md b/ja-JP/step_8.md new file mode 100644 index 0000000..2e023a0 --- /dev/null +++ b/ja-JP/step_8.md @@ -0,0 +1,17 @@ +## Challenge + +--- challenge --- + +--- task --- + +Add more pages to your website. + +--- /task --- + +--- task --- + +Install a different theme from the Appearance menu. + +--- /task --- + +--- /challenge --- diff --git a/ja-JP/step_9.md b/ja-JP/step_9.md new file mode 100644 index 0000000..fc5847a --- /dev/null +++ b/ja-JP/step_9.md @@ -0,0 +1,3 @@ +## What can you do now? + +You could try setting up a [Python web server with Flask](https://projects.raspberrypi.org/en/projects/python-web-server-with-flask) \ No newline at end of file diff --git a/ko-KR/images/Python-Webserver-with-Wordpress-TILE-01.png b/ko-KR/images/Python-Webserver-with-Wordpress-TILE-01.png new file mode 100644 index 0000000..f632634 Binary files /dev/null and b/ko-KR/images/Python-Webserver-with-Wordpress-TILE-01.png differ diff --git a/ko-KR/images/Python-Webserver-with-Wordpress.png b/ko-KR/images/Python-Webserver-with-Wordpress.png new file mode 100644 index 0000000..07b0191 Binary files /dev/null and b/ko-KR/images/Python-Webserver-with-Wordpress.png differ diff --git a/ko-KR/images/apache-hello-world.png b/ko-KR/images/apache-hello-world.png new file mode 100644 index 0000000..69fb339 Binary files /dev/null and b/ko-KR/images/apache-hello-world.png differ diff --git a/ko-KR/images/apache-it-works.png b/ko-KR/images/apache-it-works.png new file mode 100644 index 0000000..fb71d9f Binary files /dev/null and b/ko-KR/images/apache-it-works.png differ diff --git a/ko-KR/images/banner.png b/ko-KR/images/banner.png new file mode 100644 index 0000000..88a7bfb Binary files /dev/null and b/ko-KR/images/banner.png differ diff --git a/ko-KR/images/create-database.png b/ko-KR/images/create-database.png new file mode 100644 index 0000000..34c91f2 Binary files /dev/null and b/ko-KR/images/create-database.png differ diff --git a/ko-KR/images/hostname.png b/ko-KR/images/hostname.png new file mode 100644 index 0000000..bb50249 Binary files /dev/null and b/ko-KR/images/hostname.png differ diff --git a/ko-KR/images/hostname_annotated.png b/ko-KR/images/hostname_annotated.png new file mode 100644 index 0000000..27b2f08 Binary files /dev/null and b/ko-KR/images/hostname_annotated.png differ diff --git a/ko-KR/images/install_apache.png b/ko-KR/images/install_apache.png new file mode 100644 index 0000000..8b5dab8 Binary files /dev/null and b/ko-KR/images/install_apache.png differ diff --git a/ko-KR/images/wordpress-database-setup.png b/ko-KR/images/wordpress-database-setup.png new file mode 100644 index 0000000..a1b2a91 Binary files /dev/null and b/ko-KR/images/wordpress-database-setup.png differ diff --git a/ko-KR/images/wordpress-information_needed.png b/ko-KR/images/wordpress-information_needed.png new file mode 100644 index 0000000..8119d0a Binary files /dev/null and b/ko-KR/images/wordpress-information_needed.png differ diff --git a/ko-KR/images/wordpress-run-installation.png b/ko-KR/images/wordpress-run-installation.png new file mode 100644 index 0000000..b368d00 Binary files /dev/null and b/ko-KR/images/wordpress-run-installation.png differ diff --git a/ko-KR/images/wordpress-welcome.png b/ko-KR/images/wordpress-welcome.png new file mode 100644 index 0000000..9394739 Binary files /dev/null and b/ko-KR/images/wordpress-welcome.png differ diff --git a/ko-KR/images/wordpress_language.png b/ko-KR/images/wordpress_language.png new file mode 100644 index 0000000..4d44ba3 Binary files /dev/null and b/ko-KR/images/wordpress_language.png differ diff --git a/ko-KR/images/wp-info.png b/ko-KR/images/wp-info.png new file mode 100644 index 0000000..032e62e Binary files /dev/null and b/ko-KR/images/wp-info.png differ diff --git a/ko-KR/meta.yml b/ko-KR/meta.yml new file mode 100644 index 0000000..046a170 --- /dev/null +++ b/ko-KR/meta.yml @@ -0,0 +1,42 @@ +--- +title: Build a LAMP Web Server with WordPress +hero_image: images / banner.png +description: Set up a local server for a website on your Raspberry Pi +original_url: https://raspberrypi.org/learning/lamp-web-server-with-wordpress +theme: turquoise +duration: 2 +listed: true +ingredient: false +copyedit: false +curriculum: 3, 디자인 -0, 프로그래밍 -3, phys-comp-0, 제조 -0, 커뮤니티 -0 +interests: '' +technologies: raspberry-pi, html-css-javascript +site_areas: projects +hardware: raspberry-pi +software: html-css-javascript +version: 4 +last_tested: 2017-01-01 +steps: + - + title: 소개 + - + title: Set up an Apache web server + completion: + - engaged + - + title: Install PHP + - + title: Install MariaDB + - + title: Download WordPress + - + title: Set up your WordPress database + completion: + - internal + - + title: WordPress configuration + completion: + - external + - + title: Challenge + challenge: true diff --git a/ko-KR/step_1.md b/ko-KR/step_1.md new file mode 100644 index 0000000..640fd40 --- /dev/null +++ b/ko-KR/step_1.md @@ -0,0 +1,12 @@ +## 무엇을 만들 수 있을까? +Learn to set up a LAMP (**L**inux, **A**pache, **M**ySQL, **P**HP) stack on your Raspberry Pi and configure it to work as a web server. + + - Install software on your Raspberry Pi + - Install and configure Apache, PHP, and MySQL to create a LAMP web server + - Download WordPress and run it as a local website on your Raspberry Pi + - Configure WordPress and make your website accessible to other devices on your local network + + +### You will need +- A Raspberry Pi computer connected to the internet +- [An up to date install of the Raspberry Pi OS](https://www.raspberrypi.org/downloads/) diff --git a/ko-KR/step_2.md b/ko-KR/step_2.md new file mode 100644 index 0000000..1cb6c47 --- /dev/null +++ b/ko-KR/step_2.md @@ -0,0 +1,110 @@ +## Set up an Apache web server + +Apache is a popular web server application you can install on the Raspberry Pi to allow it to serve web pages. + +On its own, Apache can serve HTML files over HTTP. With additional modules it can serve dynamic web pages using scripting languages such as PHP. + +### Install Apache + +--- task --- + +Open a terminal window by selecting **Accessories** > **Terminal** from the menu. + +--- /task --- + +--- task --- + +Type the following command into the terminal and press Enter to install `apache2` + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo apt install apache2 -y + +--- /code --- + +**Tip:** If you see an error, make sure you are using the latest version of Raspberry Pi OS. + +--- /task --- + + +### Test the web server + +By default, Apache puts a test HTML file in the web folder that you will be able to view from your Pi or another computer on your network. + +--- task --- + +Open Chromium by selecting **Internet** > **Chromium Web Browser** from the menu. + +--- /task --- + +--- task --- + +Type `localhost` in the address bar. + +--- /task --- + +You should see this in your browser window: + +![Apache it works](images/apache-it-works.png) + +This means you have Apache working! + +### Changing the default web page + +This default web page is just a HTML file on the file system. It is located at `/var/www/html/index.html`. + +--- task --- + +Type the following command in the terminal to change to the directory containing the HTML file: + +--- code --- +--- +language: bash +line_numbers: false +--- +cd /var/www/html + +--- /code --- + +--- /task --- + +--- task --- + +Open the `index.html` file using Thonny + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo thonny index.html + +--- /code --- + +--- /task --- + +--- task --- + +Delete the contents of the file, then type a short message and save your changes. + +--- /task --- + +--- task --- + +Go back to Chromium and refresh the browser. You will see your message appear on the web page. + +--- /task --- + +--- collapse --- +--- +title: Access the page from another device on the network +--- + +You can open your web page from any other computer on your network, using the IP address of your Raspberry Pi, e.g. `http://192.168.1.10`. + +To find out your Raspberry Pi's IP address, type `hostname -I` into the terminal window. + +--- /collapse --- diff --git a/ko-KR/step_3.md b/ko-KR/step_3.md new file mode 100644 index 0000000..4bb6e7f --- /dev/null +++ b/ko-KR/step_3.md @@ -0,0 +1,91 @@ +## Install PHP + +PHP is a **preprocessor**: it's code that runs when the server receives a request for a web page via a web browser. It works out what needs to be shown on the page, and then sends that page to the browser. + +--- task --- + +Type the following command in the terminal to install PHP: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo apt install php -y + +--- /code --- + +--- /task --- + +### Test PHP + +--- task --- + +Type this command to delete the `index.html` file from earlier: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo rm index.html + +--- /code --- + +--- /task --- + +--- task --- + +Create a new file called `index.php`: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo thonny index.php + +--- /code --- + +--- /task --- + +--- task --- + +In the Thonny code editor, type this PHP code into the file and save it. + +--- code --- +--- +language: php +line_numbers: false +--- + + +--- /code --- + +--- /task --- + +--- task --- + +Refresh your browser. You should see "hello world". This page is not dynamic, but it is still served by PHP. + +![hello world](images/apache-hello-world.png) + +--- /task --- + + +--- collapse --- +--- +title: I can only see PHP code +--- +If you see the raw PHP above instead of "hello world", use this command to reload and restart Apache: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo service apache2 restart + +--- /code --- + +--- /collapse --- diff --git a/ko-KR/step_4.md b/ko-KR/step_4.md new file mode 100644 index 0000000..cc6eae1 --- /dev/null +++ b/ko-KR/step_4.md @@ -0,0 +1,75 @@ +## Install MariaDB + +MariaDB is a popular database engine. Like PHP, it's widely used on web servers, which is why projects like WordPress use it, and why those projects are so popular. + + +--- task --- + +Type this command to install the MariaDB Server and PHP-MySQL packages: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo apt install mariadb-server php-mysql -y + +--- /code --- + +--- /task --- + +--- task --- + +Now restart Apache: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo service apache2 restart + +--- /code --- + +--- /task --- + +### Set up + +--- task --- + +Run the MySQL secure installation command in the terminal window. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo mysql_secure_installation + +--- /code --- + +--- /task --- + +--- task --- + +Go through the setup wizard using the following answers: + ++ `Enter current password for root (enter for none):` — press **Enter**. + ++ `Switch to unix_socket authentication [Y/n]` - Type in **N** and press **Enter** + ++ `Change the root password?` - Type in **Y** and press **Enter** + ++ `New password:` - Type in a password and press **Enter**, then repeat a second time. **Important:** remember this root password, as you will need it later to set up WordPress. + ++ `Remove anonymous users` - Type in **Y** + ++ `Disallow root login remotely` - Type in **Y** + ++ `Remove test database and access to it` - Type in **Y** + ++ `Reload privilege tables now` - Type in **Y** + +--- /task --- + +When complete, you will see the message `All done!` and `Thanks for using MariaDB!`. diff --git a/ko-KR/step_5.md b/ko-KR/step_5.md new file mode 100644 index 0000000..d34db90 --- /dev/null +++ b/ko-KR/step_5.md @@ -0,0 +1,109 @@ +## Download WordPress + +WordPress is a popular tool used to quickly create a website or blog with an easy to use editor for creating new content. + + +--- task --- + +In your terminal, make sure you are still in the directory `/var/www/html/` + +--- code --- +--- +language: bash +line_numbers: false +--- +cd /var/www/html/ + +--- /code --- + +--- /task --- + +--- task --- + +Delete all the files in the folder. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo rm * + +--- /code --- + +--- /task --- + +--- task --- + +Type this command to download WordPress + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo wget http://wordpress.org/latest.tar.gz + +--- /code --- + +--- /task --- + +--- task --- + +Extract the WordPress software: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo tar xzf latest.tar.gz + +--- /code --- + +--- /task --- + +--- task --- + +Move the contents of the extracted `wordpress` directory to the current directory. **Tip:** Make sure you type the whole command including the dot. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo mv wordpress/* . + +--- /code --- + +--- /task --- + +--- task --- + +Tidy up by removing the download, and the now empty `wordpress` directory. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo rm -rf wordpress latest.tar.gz + +--- /code --- + +--- /task --- + +---task --- + +Change the ownership of all these files to the Apache user: **Tip:** Make sure you type the whole command including the dot. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo chown -R www-data: . + +--- /code --- + +--- /task --- diff --git a/ko-KR/step_6.md b/ko-KR/step_6.md new file mode 100644 index 0000000..eefa5ec --- /dev/null +++ b/ko-KR/step_6.md @@ -0,0 +1,95 @@ +## Set up your WordPress Database + +--- task --- + +Run `mysql` in the terminal window: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo mysql -uroot -p + +--- /code --- + +--- /task --- + +--- task --- + +Enter the root password you created when you set up the database. + +You will see the message `Welcome to the MariaDB monitor` and then the `MariaDB [(none)]>` prompt. + +--- /task --- + +--- task --- + +At the `MariaDB [(none)]>` prompt, type: **Tip:** Don't forget to type the semicolon at the end. + +--- code --- +--- +language: sql +line_numbers: false +--- +create database wordpress; + +--- /code --- + + + +--- /task --- + +If this has been successful, you should see `Query OK, 1 row affected (0.00 sec)`. + +--- task --- + +At the MariaDB prompt, grant database privileges to the root user. Change `YOURPASSWORD` to the password you created before. + +--- code --- +--- +language: sql +line_numbers: false +--- + +GRANT ALL PRIVILEGES ON wordpress.* TO 'root'@'localhost' IDENTIFIED BY 'YOURPASSWORD'; + +--- /code --- + +--- /task --- + +--- task --- + +For the changes to take effect, you will need to flush the database privileges: + +--- code --- +--- +language: sql +line_numbers: false +--- +FLUSH PRIVILEGES; + +--- /code --- + +--- /task --- + +--- task --- + +Exit the MariaDB prompt with Ctrl + D. + +--- /task --- + +--- task --- + +Restart your Raspberry Pi by typing this command in the terminal: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo reboot + +--- /code --- + +--- /task --- diff --git a/ko-KR/step_7.md b/ko-KR/step_7.md new file mode 100644 index 0000000..be18128 --- /dev/null +++ b/ko-KR/step_7.md @@ -0,0 +1,155 @@ +## WordPress configuration + +--- task --- + +Once your Raspberry Pi has rebooted, open Chromium and type `localhost` into the address bar. + +You should see a WordPress page asking to pick your language. + +![WordPress select language](images/wordpress_language.png) + +--- /task --- + +--- task --- + +Select your language and click **Continue**. + +--- /task --- + +You will be presented with the WordPress welcome screen. + +![WordPress welcome screen](images/wordpress-welcome.png) + +--- task --- + +Click the **Let's go!** button. + +--- /task --- + +--- task --- + +Now fill out the basic site information as follows: **Tip:** Make sure you type `wordpress` in the first box as the text displayed is only a suggestion, the box is blank. + +``` +Database Name: wordpress +User Name: root +Password: +Database Host: localhost +Table Prefix: wp_ +``` + +Click **Submit** to proceed. + +--- /task --- + + +--- task --- + +Click the **Run the install** button. + +--- /task --- + +--- task --- + +Fill in the information you are asked for, then click the `Install WordPress` button. + +--- /task --- + +--- task --- + +Log in, using the account you just created. + +Now you're logged in and have your site set up, you can see the website by visiting your `http://localhost/wp-admin`. + +--- /task --- + + +### Friendly permalinks + +It's recommended that you change your permalink settings to make your URLs more friendly. + +--- task --- + +Log in to WordPress and go to the dashboard. + +--- /task --- + +--- task --- + +Go to **Setting**, then **Permalinks**. + +--- /task --- + +--- task --- + +Select the **Post name** option and click **Save Changes**. + +--- /task --- + +--- task --- + +Type the following command in a terminal to enable Apache's `rewrite` mod: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo a2enmod rewrite + +--- /code --- + +--- /task --- + +--- task --- + +Open the Apache configuration file + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo geany /etc/apache2/sites-available/000-default.conf + +--- /code --- + +--- /task --- + +--- task --- + +Add the following lines after line 1. + +--- code --- +--- +language: sql line_numbers: true line_number_start: 2 +line_highlights: 3-5 +--- + AllowOverride All + +--- /code --- + +--- /task --- + +--- task --- + +Save the file and close Geany. + +--- /task --- + +--- task --- + +In a terminal type the command to restart Apache: + + + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo service apache2 restart + +--- /code --- + +--- /task --- \ No newline at end of file diff --git a/ko-KR/step_8.md b/ko-KR/step_8.md new file mode 100644 index 0000000..2e023a0 --- /dev/null +++ b/ko-KR/step_8.md @@ -0,0 +1,17 @@ +## Challenge + +--- challenge --- + +--- task --- + +Add more pages to your website. + +--- /task --- + +--- task --- + +Install a different theme from the Appearance menu. + +--- /task --- + +--- /challenge --- diff --git a/ko-KR/step_9.md b/ko-KR/step_9.md new file mode 100644 index 0000000..fc5847a --- /dev/null +++ b/ko-KR/step_9.md @@ -0,0 +1,3 @@ +## What can you do now? + +You could try setting up a [Python web server with Flask](https://projects.raspberrypi.org/en/projects/python-web-server-with-flask) \ No newline at end of file diff --git a/nl-NL/images/Python-Webserver-with-Wordpress-TILE-01.png b/nl-NL/images/Python-Webserver-with-Wordpress-TILE-01.png new file mode 100644 index 0000000..f632634 Binary files /dev/null and b/nl-NL/images/Python-Webserver-with-Wordpress-TILE-01.png differ diff --git a/nl-NL/images/Python-Webserver-with-Wordpress.png b/nl-NL/images/Python-Webserver-with-Wordpress.png new file mode 100644 index 0000000..07b0191 Binary files /dev/null and b/nl-NL/images/Python-Webserver-with-Wordpress.png differ diff --git a/nl-NL/images/apache-hello-world.png b/nl-NL/images/apache-hello-world.png new file mode 100644 index 0000000..ab1b5c7 Binary files /dev/null and b/nl-NL/images/apache-hello-world.png differ diff --git a/nl-NL/images/apache-it-works.png b/nl-NL/images/apache-it-works.png new file mode 100644 index 0000000..4ab5181 Binary files /dev/null and b/nl-NL/images/apache-it-works.png differ diff --git a/nl-NL/images/banner.png b/nl-NL/images/banner.png new file mode 100644 index 0000000..88a7bfb Binary files /dev/null and b/nl-NL/images/banner.png differ diff --git a/nl-NL/images/create-database.png b/nl-NL/images/create-database.png new file mode 100644 index 0000000..03db529 Binary files /dev/null and b/nl-NL/images/create-database.png differ diff --git a/nl-NL/images/hostname.png b/nl-NL/images/hostname.png new file mode 100644 index 0000000..bb50249 Binary files /dev/null and b/nl-NL/images/hostname.png differ diff --git a/nl-NL/images/hostname_annotated.png b/nl-NL/images/hostname_annotated.png new file mode 100644 index 0000000..27b2f08 Binary files /dev/null and b/nl-NL/images/hostname_annotated.png differ diff --git a/nl-NL/images/install_apache.png b/nl-NL/images/install_apache.png new file mode 100644 index 0000000..3ddc167 Binary files /dev/null and b/nl-NL/images/install_apache.png differ diff --git a/nl-NL/images/wordpress-database-setup.png b/nl-NL/images/wordpress-database-setup.png new file mode 100644 index 0000000..a1b2a91 Binary files /dev/null and b/nl-NL/images/wordpress-database-setup.png differ diff --git a/nl-NL/images/wordpress-information_needed.png b/nl-NL/images/wordpress-information_needed.png new file mode 100644 index 0000000..8119d0a Binary files /dev/null and b/nl-NL/images/wordpress-information_needed.png differ diff --git a/nl-NL/images/wordpress-run-installation.png b/nl-NL/images/wordpress-run-installation.png new file mode 100644 index 0000000..b368d00 Binary files /dev/null and b/nl-NL/images/wordpress-run-installation.png differ diff --git a/nl-NL/images/wordpress-welcome.png b/nl-NL/images/wordpress-welcome.png new file mode 100644 index 0000000..c072942 Binary files /dev/null and b/nl-NL/images/wordpress-welcome.png differ diff --git a/nl-NL/images/wordpress_language.png b/nl-NL/images/wordpress_language.png new file mode 100644 index 0000000..a9a5ad5 Binary files /dev/null and b/nl-NL/images/wordpress_language.png differ diff --git a/nl-NL/images/wp-info.png b/nl-NL/images/wp-info.png new file mode 100644 index 0000000..df56915 Binary files /dev/null and b/nl-NL/images/wp-info.png differ diff --git a/nl-NL/meta.yml b/nl-NL/meta.yml new file mode 100644 index 0000000..0f0cf04 --- /dev/null +++ b/nl-NL/meta.yml @@ -0,0 +1,42 @@ +--- +title: Bouw een LAMP-webserver met WordPress +hero_image: afbeeldingen / banner.png +description: Stel een lokale server in voor een website op je Raspberry Pi +original_url: https://raspberrypi.org/learning/lamp-web-server-with-wordpress +theme: turquoise +duration: 2 +listed: true +ingredient: false +copyedit: false +curriculum: 3, design-0, programming-3, phys-comp-0, manufacture-0, community-0 +interests: '' +technologies: raspberry-pi, html-css-javascript +site_areas: projects +hardware: raspberry-pi +software: html-css-javascript +version: 4 +last_tested: 2017/01/01 +steps: + - + title: Inleiding + - + title: Wat heb je nodig + completion: + - engaged + - + title: Stel een Apache-webserver in + - + title: Installeer PHP + - + title: Installeer MySQL + - + title: Download WordPress + completion: + - internal + - + title: Stel je WordPress-database in + completion: + - external + - + title: WordPress-configuratie + challenge: true diff --git a/nl-NL/step_1.md b/nl-NL/step_1.md new file mode 100644 index 0000000..f1e85d1 --- /dev/null +++ b/nl-NL/step_1.md @@ -0,0 +1,12 @@ +## Wat ga je maken +Leer een LAMP (**L**inux, **A**pache, **M**ySQL, **P**HP)-systeem in te stellen op je Raspberry Pi en te configureren om als webserver te werken. + + - Software installeert op je Raspberry Pi + - Apache, PHP en MySQL installeert en configureert om een LAMP-webserver te maken + - WordPress downloadt en het uitvoert als een lokale website op je Raspberry Pi + - WordPress configureert en je website toegankelijk maakt voor andere apparaten in je lokale netwerk + + +### You will need +- A Raspberry Pi computer connected to the internet +- [An up to date install of the Raspberry Pi OS](https://www.raspberrypi.org/downloads/) diff --git a/nl-NL/step_2.md b/nl-NL/step_2.md new file mode 100644 index 0000000..1cb6c47 --- /dev/null +++ b/nl-NL/step_2.md @@ -0,0 +1,110 @@ +## Set up an Apache web server + +Apache is a popular web server application you can install on the Raspberry Pi to allow it to serve web pages. + +On its own, Apache can serve HTML files over HTTP. With additional modules it can serve dynamic web pages using scripting languages such as PHP. + +### Install Apache + +--- task --- + +Open a terminal window by selecting **Accessories** > **Terminal** from the menu. + +--- /task --- + +--- task --- + +Type the following command into the terminal and press Enter to install `apache2` + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo apt install apache2 -y + +--- /code --- + +**Tip:** If you see an error, make sure you are using the latest version of Raspberry Pi OS. + +--- /task --- + + +### Test the web server + +By default, Apache puts a test HTML file in the web folder that you will be able to view from your Pi or another computer on your network. + +--- task --- + +Open Chromium by selecting **Internet** > **Chromium Web Browser** from the menu. + +--- /task --- + +--- task --- + +Type `localhost` in the address bar. + +--- /task --- + +You should see this in your browser window: + +![Apache it works](images/apache-it-works.png) + +This means you have Apache working! + +### Changing the default web page + +This default web page is just a HTML file on the file system. It is located at `/var/www/html/index.html`. + +--- task --- + +Type the following command in the terminal to change to the directory containing the HTML file: + +--- code --- +--- +language: bash +line_numbers: false +--- +cd /var/www/html + +--- /code --- + +--- /task --- + +--- task --- + +Open the `index.html` file using Thonny + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo thonny index.html + +--- /code --- + +--- /task --- + +--- task --- + +Delete the contents of the file, then type a short message and save your changes. + +--- /task --- + +--- task --- + +Go back to Chromium and refresh the browser. You will see your message appear on the web page. + +--- /task --- + +--- collapse --- +--- +title: Access the page from another device on the network +--- + +You can open your web page from any other computer on your network, using the IP address of your Raspberry Pi, e.g. `http://192.168.1.10`. + +To find out your Raspberry Pi's IP address, type `hostname -I` into the terminal window. + +--- /collapse --- diff --git a/nl-NL/step_3.md b/nl-NL/step_3.md new file mode 100644 index 0000000..ab97ccb --- /dev/null +++ b/nl-NL/step_3.md @@ -0,0 +1,91 @@ +## Installeer Apache + +PHP is a **preprocessor**: it's code that runs when the server receives a request for a web page via a web browser. It works out what needs to be shown on the page, and then sends that page to the browser. + +--- task --- + +Type the following command in the terminal to install PHP: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo apt install php -y + +--- /code --- + +--- /task --- + +### Test PHP + +--- task --- + +Type this command to delete the `index.html` file from earlier: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo rm index.html + +--- /code --- + +--- /task --- + +--- task --- + +Create a new file called `index.php`: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo thonny index.php + +--- /code --- + +--- /task --- + +--- task --- + +In the Thonny code editor, type this PHP code into the file and save it. + +--- code --- +--- +language: php +line_numbers: false +--- + + +--- /code --- + +--- /task --- + +--- task --- + +Refresh your browser. You should see "hello world". This page is not dynamic, but it is still served by PHP. + +![hello world](images/apache-hello-world.png) + +--- /task --- + + +--- collapse --- +--- +title: I can only see PHP code +--- +If you see the raw PHP above instead of "hello world", use this command to reload and restart Apache: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo service apache2 restart + +--- /code --- + +--- /collapse --- diff --git a/nl-NL/step_4.md b/nl-NL/step_4.md new file mode 100644 index 0000000..c658352 --- /dev/null +++ b/nl-NL/step_4.md @@ -0,0 +1,75 @@ +## Install MariaDB + +MariaDB is a popular database engine. PHP is een zeer populaire taal op internet: grote projecten zoals Facebook en Wikipedia zijn geschreven in PHP. + + +--- task --- + +Installeer het PHP-pakket met de volgende opdracht: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo apt install mariadb-server php-mysql -y + +--- /code --- + +--- /task --- + +--- task --- + +Now restart Apache: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo service apache2 restart + +--- /code --- + +--- /task --- + +### Set up + +--- task --- + +Run the MySQL secure installation command in the terminal window. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo mysql_secure_installation + +--- /code --- + +--- /task --- + +--- task --- + +Go through the setup wizard using the following answers: + ++ `Enter current password for root (enter for none):` — press **Enter**. + ++ `Switch to unix_socket authentication [Y/n]` - Type in **N** and press **Enter** + ++ `Change the root password?` - Type in **Y** and press **Enter** + ++ `New password:` - Type in a password and press **Enter**, then repeat a second time. **Important:** remember this root password, as you will need it later to set up WordPress. + ++ `Remove anonymous users` - Type in **Y** + ++ `Disallow root login remotely` - Type in **Y** + ++ `Remove test database and access to it` - Type in **Y** + ++ `Reload privilege tables now` - Type in **Y** + +--- /task --- + +When complete, you will see the message `All done!` and `Thanks for using MariaDB!`. diff --git a/nl-NL/step_5.md b/nl-NL/step_5.md new file mode 100644 index 0000000..d34db90 --- /dev/null +++ b/nl-NL/step_5.md @@ -0,0 +1,109 @@ +## Download WordPress + +WordPress is a popular tool used to quickly create a website or blog with an easy to use editor for creating new content. + + +--- task --- + +In your terminal, make sure you are still in the directory `/var/www/html/` + +--- code --- +--- +language: bash +line_numbers: false +--- +cd /var/www/html/ + +--- /code --- + +--- /task --- + +--- task --- + +Delete all the files in the folder. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo rm * + +--- /code --- + +--- /task --- + +--- task --- + +Type this command to download WordPress + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo wget http://wordpress.org/latest.tar.gz + +--- /code --- + +--- /task --- + +--- task --- + +Extract the WordPress software: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo tar xzf latest.tar.gz + +--- /code --- + +--- /task --- + +--- task --- + +Move the contents of the extracted `wordpress` directory to the current directory. **Tip:** Make sure you type the whole command including the dot. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo mv wordpress/* . + +--- /code --- + +--- /task --- + +--- task --- + +Tidy up by removing the download, and the now empty `wordpress` directory. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo rm -rf wordpress latest.tar.gz + +--- /code --- + +--- /task --- + +---task --- + +Change the ownership of all these files to the Apache user: **Tip:** Make sure you type the whole command including the dot. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo chown -R www-data: . + +--- /code --- + +--- /task --- diff --git a/nl-NL/step_6.md b/nl-NL/step_6.md new file mode 100644 index 0000000..eefa5ec --- /dev/null +++ b/nl-NL/step_6.md @@ -0,0 +1,95 @@ +## Set up your WordPress Database + +--- task --- + +Run `mysql` in the terminal window: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo mysql -uroot -p + +--- /code --- + +--- /task --- + +--- task --- + +Enter the root password you created when you set up the database. + +You will see the message `Welcome to the MariaDB monitor` and then the `MariaDB [(none)]>` prompt. + +--- /task --- + +--- task --- + +At the `MariaDB [(none)]>` prompt, type: **Tip:** Don't forget to type the semicolon at the end. + +--- code --- +--- +language: sql +line_numbers: false +--- +create database wordpress; + +--- /code --- + + + +--- /task --- + +If this has been successful, you should see `Query OK, 1 row affected (0.00 sec)`. + +--- task --- + +At the MariaDB prompt, grant database privileges to the root user. Change `YOURPASSWORD` to the password you created before. + +--- code --- +--- +language: sql +line_numbers: false +--- + +GRANT ALL PRIVILEGES ON wordpress.* TO 'root'@'localhost' IDENTIFIED BY 'YOURPASSWORD'; + +--- /code --- + +--- /task --- + +--- task --- + +For the changes to take effect, you will need to flush the database privileges: + +--- code --- +--- +language: sql +line_numbers: false +--- +FLUSH PRIVILEGES; + +--- /code --- + +--- /task --- + +--- task --- + +Exit the MariaDB prompt with Ctrl + D. + +--- /task --- + +--- task --- + +Restart your Raspberry Pi by typing this command in the terminal: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo reboot + +--- /code --- + +--- /task --- diff --git a/nl-NL/step_7.md b/nl-NL/step_7.md new file mode 100644 index 0000000..3df74d1 --- /dev/null +++ b/nl-NL/step_7.md @@ -0,0 +1,155 @@ +## Stel je WordPress-database in + +--- task --- + +Once your Raspberry Pi has rebooted, open Chromium and type `localhost` into the address bar. + +You should see a WordPress page asking to pick your language. + +![WordPress select language](images/wordpress_language.png) + +--- /task --- + +--- task --- + +Select your language and click **Continue**. + +--- /task --- + +You will be presented with the WordPress welcome screen. + +![WordPress welcome screen](images/wordpress-welcome.png) + +--- task --- + +Typ **Y** en druk op **Enter** voor `Set root password?`. + +--- /task --- + +--- task --- + +Now fill out the basic site information as follows: **Tip:** Make sure you type `wordpress` in the first box as the text displayed is only a suggestion, the box is blank. + +``` +Database Name: wordpress +User Name: root +Password: +Database Host: localhost +Table Prefix: wp_ +``` + +Typ **Y** voor `Reload privilege tables now`. + +--- /task --- + + +--- task --- + +Je wordt gevraagd `Enter current password for root (enter for none):` — druk op **Enter**. + +--- /task --- + +--- task --- + +Fill in the information you are asked for, then click the `Install WordPress` button. + +--- /task --- + +--- task --- + +Log in, using the account you just created. + +Now you're logged in and have your site set up, you can see the website by visiting your `http://localhost/wp-admin`. + +--- /task --- + + +### Friendly permalinks + +It's recommended that you change your permalink settings to make your URLs more friendly. + +--- task --- + +Log in to WordPress and go to the dashboard. + +--- /task --- + +--- task --- + +Typ **Y** voor `Remove anonymous users`. + +--- /task --- + +--- task --- + +Select the **Post name** option and click **Save Changes**. + +--- /task --- + +--- task --- + +Type the following command in a terminal to enable Apache's `rewrite` mod: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo a2enmod rewrite + +--- /code --- + +--- /task --- + +--- task --- + +Open the Apache configuration file + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo geany /etc/apache2/sites-available/000-default.conf + +--- /code --- + +--- /task --- + +--- task --- + +Add the following lines after line 1. + +--- code --- +--- +language: sql line_numbers: true line_number_start: 2 +line_highlights: 3-5 +--- + AllowOverride All + +--- /code --- + +--- /task --- + +--- task --- + +Save the file and close Geany. + +--- /task --- + +--- task --- + +In a terminal type the command to restart Apache: + + + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo service apache2 restart + +--- /code --- + +--- /task --- \ No newline at end of file diff --git a/nl-NL/step_8.md b/nl-NL/step_8.md new file mode 100644 index 0000000..2e023a0 --- /dev/null +++ b/nl-NL/step_8.md @@ -0,0 +1,17 @@ +## Challenge + +--- challenge --- + +--- task --- + +Add more pages to your website. + +--- /task --- + +--- task --- + +Install a different theme from the Appearance menu. + +--- /task --- + +--- /challenge --- diff --git a/nl-NL/step_9.md b/nl-NL/step_9.md new file mode 100644 index 0000000..b08d7e3 --- /dev/null +++ b/nl-NL/step_9.md @@ -0,0 +1,3 @@ +## Wat kun je verder nog doen? + +You could try setting up a [Python web server with Flask](https://projects.raspberrypi.org/en/projects/python-web-server-with-flask) \ No newline at end of file diff --git a/no-NO/images/Python-Webserver-with-Wordpress-TILE-01.png b/no-NO/images/Python-Webserver-with-Wordpress-TILE-01.png new file mode 100644 index 0000000..f632634 Binary files /dev/null and b/no-NO/images/Python-Webserver-with-Wordpress-TILE-01.png differ diff --git a/no-NO/images/Python-Webserver-with-Wordpress.png b/no-NO/images/Python-Webserver-with-Wordpress.png new file mode 100644 index 0000000..07b0191 Binary files /dev/null and b/no-NO/images/Python-Webserver-with-Wordpress.png differ diff --git a/no-NO/images/apache-hello-world.png b/no-NO/images/apache-hello-world.png new file mode 100644 index 0000000..69fb339 Binary files /dev/null and b/no-NO/images/apache-hello-world.png differ diff --git a/no-NO/images/apache-it-works.png b/no-NO/images/apache-it-works.png new file mode 100644 index 0000000..fb71d9f Binary files /dev/null and b/no-NO/images/apache-it-works.png differ diff --git a/no-NO/images/banner.png b/no-NO/images/banner.png new file mode 100644 index 0000000..88a7bfb Binary files /dev/null and b/no-NO/images/banner.png differ diff --git a/no-NO/images/create-database.png b/no-NO/images/create-database.png new file mode 100644 index 0000000..34c91f2 Binary files /dev/null and b/no-NO/images/create-database.png differ diff --git a/no-NO/images/hostname.png b/no-NO/images/hostname.png new file mode 100644 index 0000000..bb50249 Binary files /dev/null and b/no-NO/images/hostname.png differ diff --git a/no-NO/images/hostname_annotated.png b/no-NO/images/hostname_annotated.png new file mode 100644 index 0000000..27b2f08 Binary files /dev/null and b/no-NO/images/hostname_annotated.png differ diff --git a/no-NO/images/install_apache.png b/no-NO/images/install_apache.png new file mode 100644 index 0000000..8b5dab8 Binary files /dev/null and b/no-NO/images/install_apache.png differ diff --git a/no-NO/images/wordpress-database-setup.png b/no-NO/images/wordpress-database-setup.png new file mode 100644 index 0000000..a1b2a91 Binary files /dev/null and b/no-NO/images/wordpress-database-setup.png differ diff --git a/no-NO/images/wordpress-information_needed.png b/no-NO/images/wordpress-information_needed.png new file mode 100644 index 0000000..8119d0a Binary files /dev/null and b/no-NO/images/wordpress-information_needed.png differ diff --git a/no-NO/images/wordpress-run-installation.png b/no-NO/images/wordpress-run-installation.png new file mode 100644 index 0000000..b368d00 Binary files /dev/null and b/no-NO/images/wordpress-run-installation.png differ diff --git a/no-NO/images/wordpress-welcome.png b/no-NO/images/wordpress-welcome.png new file mode 100644 index 0000000..9394739 Binary files /dev/null and b/no-NO/images/wordpress-welcome.png differ diff --git a/no-NO/images/wordpress_language.png b/no-NO/images/wordpress_language.png new file mode 100644 index 0000000..4d44ba3 Binary files /dev/null and b/no-NO/images/wordpress_language.png differ diff --git a/no-NO/images/wp-info.png b/no-NO/images/wp-info.png new file mode 100644 index 0000000..032e62e Binary files /dev/null and b/no-NO/images/wp-info.png differ diff --git a/no-NO/meta.yml b/no-NO/meta.yml new file mode 100644 index 0000000..4b18faa --- /dev/null +++ b/no-NO/meta.yml @@ -0,0 +1,42 @@ +--- +title: Build a LAMP Web Server with WordPress +hero_image: images/banner.png +description: Set up a local server for a website on your Raspberry Pi +original_url: https://raspberrypi.org/learning/lamp-web-server-with-wordpress +theme: turquoise +duration: 2 +listed: true +ingredient: false +copyedit: false +curriculum: 3, design-0, programming-3, phys-comp-0, manufacture-0, community-0 +interests: '' +technologies: raspberry-pi, html-css-javascript +site_areas: projects +hardware: raspberry-pi +software: html-css-javascript +version: 4 +last_tested: 2017-01-01 +steps: + - + title: Introduksjon + - + title: Set up an Apache web server + completion: + - engaged + - + title: Install PHP + - + title: Install MariaDB + - + title: Download WordPress + - + title: Set up your WordPress database + completion: + - internal + - + title: WordPress configuration + completion: + - external + - + title: Challenge + challenge: true diff --git a/no-NO/step_1.md b/no-NO/step_1.md new file mode 100644 index 0000000..1e59e46 --- /dev/null +++ b/no-NO/step_1.md @@ -0,0 +1,12 @@ +## Hva du vil lage +Learn to set up a LAMP (**L**inux, **A**pache, **M**ySQL, **P**HP) stack on your Raspberry Pi and configure it to work as a web server. + + - Install software on your Raspberry Pi + - Install and configure Apache, PHP, and MySQL to create a LAMP web server + - Download WordPress and run it as a local website on your Raspberry Pi + - Configure WordPress and make your website accessible to other devices on your local network + + +### You will need +- A Raspberry Pi computer connected to the internet +- [An up to date install of the Raspberry Pi OS](https://www.raspberrypi.org/downloads/) diff --git a/no-NO/step_2.md b/no-NO/step_2.md new file mode 100644 index 0000000..1cb6c47 --- /dev/null +++ b/no-NO/step_2.md @@ -0,0 +1,110 @@ +## Set up an Apache web server + +Apache is a popular web server application you can install on the Raspberry Pi to allow it to serve web pages. + +On its own, Apache can serve HTML files over HTTP. With additional modules it can serve dynamic web pages using scripting languages such as PHP. + +### Install Apache + +--- task --- + +Open a terminal window by selecting **Accessories** > **Terminal** from the menu. + +--- /task --- + +--- task --- + +Type the following command into the terminal and press Enter to install `apache2` + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo apt install apache2 -y + +--- /code --- + +**Tip:** If you see an error, make sure you are using the latest version of Raspberry Pi OS. + +--- /task --- + + +### Test the web server + +By default, Apache puts a test HTML file in the web folder that you will be able to view from your Pi or another computer on your network. + +--- task --- + +Open Chromium by selecting **Internet** > **Chromium Web Browser** from the menu. + +--- /task --- + +--- task --- + +Type `localhost` in the address bar. + +--- /task --- + +You should see this in your browser window: + +![Apache it works](images/apache-it-works.png) + +This means you have Apache working! + +### Changing the default web page + +This default web page is just a HTML file on the file system. It is located at `/var/www/html/index.html`. + +--- task --- + +Type the following command in the terminal to change to the directory containing the HTML file: + +--- code --- +--- +language: bash +line_numbers: false +--- +cd /var/www/html + +--- /code --- + +--- /task --- + +--- task --- + +Open the `index.html` file using Thonny + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo thonny index.html + +--- /code --- + +--- /task --- + +--- task --- + +Delete the contents of the file, then type a short message and save your changes. + +--- /task --- + +--- task --- + +Go back to Chromium and refresh the browser. You will see your message appear on the web page. + +--- /task --- + +--- collapse --- +--- +title: Access the page from another device on the network +--- + +You can open your web page from any other computer on your network, using the IP address of your Raspberry Pi, e.g. `http://192.168.1.10`. + +To find out your Raspberry Pi's IP address, type `hostname -I` into the terminal window. + +--- /collapse --- diff --git a/no-NO/step_3.md b/no-NO/step_3.md new file mode 100644 index 0000000..4bb6e7f --- /dev/null +++ b/no-NO/step_3.md @@ -0,0 +1,91 @@ +## Install PHP + +PHP is a **preprocessor**: it's code that runs when the server receives a request for a web page via a web browser. It works out what needs to be shown on the page, and then sends that page to the browser. + +--- task --- + +Type the following command in the terminal to install PHP: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo apt install php -y + +--- /code --- + +--- /task --- + +### Test PHP + +--- task --- + +Type this command to delete the `index.html` file from earlier: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo rm index.html + +--- /code --- + +--- /task --- + +--- task --- + +Create a new file called `index.php`: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo thonny index.php + +--- /code --- + +--- /task --- + +--- task --- + +In the Thonny code editor, type this PHP code into the file and save it. + +--- code --- +--- +language: php +line_numbers: false +--- + + +--- /code --- + +--- /task --- + +--- task --- + +Refresh your browser. You should see "hello world". This page is not dynamic, but it is still served by PHP. + +![hello world](images/apache-hello-world.png) + +--- /task --- + + +--- collapse --- +--- +title: I can only see PHP code +--- +If you see the raw PHP above instead of "hello world", use this command to reload and restart Apache: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo service apache2 restart + +--- /code --- + +--- /collapse --- diff --git a/no-NO/step_4.md b/no-NO/step_4.md new file mode 100644 index 0000000..cc6eae1 --- /dev/null +++ b/no-NO/step_4.md @@ -0,0 +1,75 @@ +## Install MariaDB + +MariaDB is a popular database engine. Like PHP, it's widely used on web servers, which is why projects like WordPress use it, and why those projects are so popular. + + +--- task --- + +Type this command to install the MariaDB Server and PHP-MySQL packages: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo apt install mariadb-server php-mysql -y + +--- /code --- + +--- /task --- + +--- task --- + +Now restart Apache: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo service apache2 restart + +--- /code --- + +--- /task --- + +### Set up + +--- task --- + +Run the MySQL secure installation command in the terminal window. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo mysql_secure_installation + +--- /code --- + +--- /task --- + +--- task --- + +Go through the setup wizard using the following answers: + ++ `Enter current password for root (enter for none):` — press **Enter**. + ++ `Switch to unix_socket authentication [Y/n]` - Type in **N** and press **Enter** + ++ `Change the root password?` - Type in **Y** and press **Enter** + ++ `New password:` - Type in a password and press **Enter**, then repeat a second time. **Important:** remember this root password, as you will need it later to set up WordPress. + ++ `Remove anonymous users` - Type in **Y** + ++ `Disallow root login remotely` - Type in **Y** + ++ `Remove test database and access to it` - Type in **Y** + ++ `Reload privilege tables now` - Type in **Y** + +--- /task --- + +When complete, you will see the message `All done!` and `Thanks for using MariaDB!`. diff --git a/no-NO/step_5.md b/no-NO/step_5.md new file mode 100644 index 0000000..d34db90 --- /dev/null +++ b/no-NO/step_5.md @@ -0,0 +1,109 @@ +## Download WordPress + +WordPress is a popular tool used to quickly create a website or blog with an easy to use editor for creating new content. + + +--- task --- + +In your terminal, make sure you are still in the directory `/var/www/html/` + +--- code --- +--- +language: bash +line_numbers: false +--- +cd /var/www/html/ + +--- /code --- + +--- /task --- + +--- task --- + +Delete all the files in the folder. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo rm * + +--- /code --- + +--- /task --- + +--- task --- + +Type this command to download WordPress + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo wget http://wordpress.org/latest.tar.gz + +--- /code --- + +--- /task --- + +--- task --- + +Extract the WordPress software: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo tar xzf latest.tar.gz + +--- /code --- + +--- /task --- + +--- task --- + +Move the contents of the extracted `wordpress` directory to the current directory. **Tip:** Make sure you type the whole command including the dot. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo mv wordpress/* . + +--- /code --- + +--- /task --- + +--- task --- + +Tidy up by removing the download, and the now empty `wordpress` directory. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo rm -rf wordpress latest.tar.gz + +--- /code --- + +--- /task --- + +---task --- + +Change the ownership of all these files to the Apache user: **Tip:** Make sure you type the whole command including the dot. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo chown -R www-data: . + +--- /code --- + +--- /task --- diff --git a/no-NO/step_6.md b/no-NO/step_6.md new file mode 100644 index 0000000..eefa5ec --- /dev/null +++ b/no-NO/step_6.md @@ -0,0 +1,95 @@ +## Set up your WordPress Database + +--- task --- + +Run `mysql` in the terminal window: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo mysql -uroot -p + +--- /code --- + +--- /task --- + +--- task --- + +Enter the root password you created when you set up the database. + +You will see the message `Welcome to the MariaDB monitor` and then the `MariaDB [(none)]>` prompt. + +--- /task --- + +--- task --- + +At the `MariaDB [(none)]>` prompt, type: **Tip:** Don't forget to type the semicolon at the end. + +--- code --- +--- +language: sql +line_numbers: false +--- +create database wordpress; + +--- /code --- + + + +--- /task --- + +If this has been successful, you should see `Query OK, 1 row affected (0.00 sec)`. + +--- task --- + +At the MariaDB prompt, grant database privileges to the root user. Change `YOURPASSWORD` to the password you created before. + +--- code --- +--- +language: sql +line_numbers: false +--- + +GRANT ALL PRIVILEGES ON wordpress.* TO 'root'@'localhost' IDENTIFIED BY 'YOURPASSWORD'; + +--- /code --- + +--- /task --- + +--- task --- + +For the changes to take effect, you will need to flush the database privileges: + +--- code --- +--- +language: sql +line_numbers: false +--- +FLUSH PRIVILEGES; + +--- /code --- + +--- /task --- + +--- task --- + +Exit the MariaDB prompt with Ctrl + D. + +--- /task --- + +--- task --- + +Restart your Raspberry Pi by typing this command in the terminal: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo reboot + +--- /code --- + +--- /task --- diff --git a/no-NO/step_7.md b/no-NO/step_7.md new file mode 100644 index 0000000..be18128 --- /dev/null +++ b/no-NO/step_7.md @@ -0,0 +1,155 @@ +## WordPress configuration + +--- task --- + +Once your Raspberry Pi has rebooted, open Chromium and type `localhost` into the address bar. + +You should see a WordPress page asking to pick your language. + +![WordPress select language](images/wordpress_language.png) + +--- /task --- + +--- task --- + +Select your language and click **Continue**. + +--- /task --- + +You will be presented with the WordPress welcome screen. + +![WordPress welcome screen](images/wordpress-welcome.png) + +--- task --- + +Click the **Let's go!** button. + +--- /task --- + +--- task --- + +Now fill out the basic site information as follows: **Tip:** Make sure you type `wordpress` in the first box as the text displayed is only a suggestion, the box is blank. + +``` +Database Name: wordpress +User Name: root +Password: +Database Host: localhost +Table Prefix: wp_ +``` + +Click **Submit** to proceed. + +--- /task --- + + +--- task --- + +Click the **Run the install** button. + +--- /task --- + +--- task --- + +Fill in the information you are asked for, then click the `Install WordPress` button. + +--- /task --- + +--- task --- + +Log in, using the account you just created. + +Now you're logged in and have your site set up, you can see the website by visiting your `http://localhost/wp-admin`. + +--- /task --- + + +### Friendly permalinks + +It's recommended that you change your permalink settings to make your URLs more friendly. + +--- task --- + +Log in to WordPress and go to the dashboard. + +--- /task --- + +--- task --- + +Go to **Setting**, then **Permalinks**. + +--- /task --- + +--- task --- + +Select the **Post name** option and click **Save Changes**. + +--- /task --- + +--- task --- + +Type the following command in a terminal to enable Apache's `rewrite` mod: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo a2enmod rewrite + +--- /code --- + +--- /task --- + +--- task --- + +Open the Apache configuration file + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo geany /etc/apache2/sites-available/000-default.conf + +--- /code --- + +--- /task --- + +--- task --- + +Add the following lines after line 1. + +--- code --- +--- +language: sql line_numbers: true line_number_start: 2 +line_highlights: 3-5 +--- + AllowOverride All + +--- /code --- + +--- /task --- + +--- task --- + +Save the file and close Geany. + +--- /task --- + +--- task --- + +In a terminal type the command to restart Apache: + + + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo service apache2 restart + +--- /code --- + +--- /task --- \ No newline at end of file diff --git a/no-NO/step_8.md b/no-NO/step_8.md new file mode 100644 index 0000000..2e023a0 --- /dev/null +++ b/no-NO/step_8.md @@ -0,0 +1,17 @@ +## Challenge + +--- challenge --- + +--- task --- + +Add more pages to your website. + +--- /task --- + +--- task --- + +Install a different theme from the Appearance menu. + +--- /task --- + +--- /challenge --- diff --git a/no-NO/step_9.md b/no-NO/step_9.md new file mode 100644 index 0000000..fc5847a --- /dev/null +++ b/no-NO/step_9.md @@ -0,0 +1,3 @@ +## What can you do now? + +You could try setting up a [Python web server with Flask](https://projects.raspberrypi.org/en/projects/python-web-server-with-flask) \ No newline at end of file diff --git a/pl-PL/images/Python-Webserver-with-Wordpress-TILE-01.png b/pl-PL/images/Python-Webserver-with-Wordpress-TILE-01.png new file mode 100644 index 0000000..f632634 Binary files /dev/null and b/pl-PL/images/Python-Webserver-with-Wordpress-TILE-01.png differ diff --git a/pl-PL/images/Python-Webserver-with-Wordpress.png b/pl-PL/images/Python-Webserver-with-Wordpress.png new file mode 100644 index 0000000..07b0191 Binary files /dev/null and b/pl-PL/images/Python-Webserver-with-Wordpress.png differ diff --git a/pl-PL/images/apache-hello-world.png b/pl-PL/images/apache-hello-world.png new file mode 100644 index 0000000..69fb339 Binary files /dev/null and b/pl-PL/images/apache-hello-world.png differ diff --git a/pl-PL/images/apache-it-works.png b/pl-PL/images/apache-it-works.png new file mode 100644 index 0000000..fb71d9f Binary files /dev/null and b/pl-PL/images/apache-it-works.png differ diff --git a/pl-PL/images/banner.png b/pl-PL/images/banner.png new file mode 100644 index 0000000..88a7bfb Binary files /dev/null and b/pl-PL/images/banner.png differ diff --git a/pl-PL/images/create-database.png b/pl-PL/images/create-database.png new file mode 100644 index 0000000..34c91f2 Binary files /dev/null and b/pl-PL/images/create-database.png differ diff --git a/pl-PL/images/hostname.png b/pl-PL/images/hostname.png new file mode 100644 index 0000000..bb50249 Binary files /dev/null and b/pl-PL/images/hostname.png differ diff --git a/pl-PL/images/hostname_annotated.png b/pl-PL/images/hostname_annotated.png new file mode 100644 index 0000000..27b2f08 Binary files /dev/null and b/pl-PL/images/hostname_annotated.png differ diff --git a/pl-PL/images/install_apache.png b/pl-PL/images/install_apache.png new file mode 100644 index 0000000..8b5dab8 Binary files /dev/null and b/pl-PL/images/install_apache.png differ diff --git a/pl-PL/images/wordpress-database-setup.png b/pl-PL/images/wordpress-database-setup.png new file mode 100644 index 0000000..a1b2a91 Binary files /dev/null and b/pl-PL/images/wordpress-database-setup.png differ diff --git a/pl-PL/images/wordpress-information_needed.png b/pl-PL/images/wordpress-information_needed.png new file mode 100644 index 0000000..8119d0a Binary files /dev/null and b/pl-PL/images/wordpress-information_needed.png differ diff --git a/pl-PL/images/wordpress-run-installation.png b/pl-PL/images/wordpress-run-installation.png new file mode 100644 index 0000000..b368d00 Binary files /dev/null and b/pl-PL/images/wordpress-run-installation.png differ diff --git a/pl-PL/images/wordpress-welcome.png b/pl-PL/images/wordpress-welcome.png new file mode 100644 index 0000000..9394739 Binary files /dev/null and b/pl-PL/images/wordpress-welcome.png differ diff --git a/pl-PL/images/wordpress_language.png b/pl-PL/images/wordpress_language.png new file mode 100644 index 0000000..4d44ba3 Binary files /dev/null and b/pl-PL/images/wordpress_language.png differ diff --git a/pl-PL/images/wp-info.png b/pl-PL/images/wp-info.png new file mode 100644 index 0000000..032e62e Binary files /dev/null and b/pl-PL/images/wp-info.png differ diff --git a/pl-PL/meta.yml b/pl-PL/meta.yml new file mode 100644 index 0000000..b0a0629 --- /dev/null +++ b/pl-PL/meta.yml @@ -0,0 +1,42 @@ +--- +title: Zbuduj serwer WWW LAMP za pomocą WordPress +hero_image: images / banner.png +description: Skonfiguruj lokalny serwer dla strony internetowej na swoim Raspberry Pi +original_url: https://raspberrypi.org/learning/lamp-web-server-with-wordpress +theme: turquoise +duration: 2 +listed: true +ingredient: false +copyedit: false +curriculum: 3, design-0, programming-3, phys-comp-0, manufacture-0, community-0 +interests: '' +technologies: raspberry-pi, html-css-javascript +site_areas: projekty +hardware: raspberry-pi +software: html-css-javascript +version: 4 +last_tested: 2017-01-01 +steps: + - + title: Wprowadzenie + - + title: Set up an Apache web server + completion: + - engaged + - + title: Install PHP + - + title: Install MariaDB + - + title: Download WordPress + - + title: Set up your WordPress database + completion: + - internal + - + title: WordPress configuration + completion: + - external + - + title: Challenge + challenge: true diff --git a/pl-PL/step_1.md b/pl-PL/step_1.md new file mode 100644 index 0000000..4b47363 --- /dev/null +++ b/pl-PL/step_1.md @@ -0,0 +1,12 @@ +## Co stworzysz +Learn to set up a LAMP (**L**inux, **A**pache, **M**ySQL, **P**HP) stack on your Raspberry Pi and configure it to work as a web server. + + - Zainstalować oprogramowanie na swoim Raspberry Pi + - Zainstalować i skonfigurować Apache, PHP i MySQL, aby utworzyć serwer stron www oparty na pakiecie LAMP + - Pobrać WordPress i uruchomić go jako lokalną stronę internetową na swoim Raspberry Pi + - Skonfigurować WordPress i udostępnić swoją stronę innym urządzeniom w sieci lokalnej + + +### You will need +- A Raspberry Pi computer connected to the internet +- [An up to date install of the Raspberry Pi OS](https://www.raspberrypi.org/downloads/) diff --git a/pl-PL/step_2.md b/pl-PL/step_2.md new file mode 100644 index 0000000..1cb6c47 --- /dev/null +++ b/pl-PL/step_2.md @@ -0,0 +1,110 @@ +## Set up an Apache web server + +Apache is a popular web server application you can install on the Raspberry Pi to allow it to serve web pages. + +On its own, Apache can serve HTML files over HTTP. With additional modules it can serve dynamic web pages using scripting languages such as PHP. + +### Install Apache + +--- task --- + +Open a terminal window by selecting **Accessories** > **Terminal** from the menu. + +--- /task --- + +--- task --- + +Type the following command into the terminal and press Enter to install `apache2` + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo apt install apache2 -y + +--- /code --- + +**Tip:** If you see an error, make sure you are using the latest version of Raspberry Pi OS. + +--- /task --- + + +### Test the web server + +By default, Apache puts a test HTML file in the web folder that you will be able to view from your Pi or another computer on your network. + +--- task --- + +Open Chromium by selecting **Internet** > **Chromium Web Browser** from the menu. + +--- /task --- + +--- task --- + +Type `localhost` in the address bar. + +--- /task --- + +You should see this in your browser window: + +![Apache it works](images/apache-it-works.png) + +This means you have Apache working! + +### Changing the default web page + +This default web page is just a HTML file on the file system. It is located at `/var/www/html/index.html`. + +--- task --- + +Type the following command in the terminal to change to the directory containing the HTML file: + +--- code --- +--- +language: bash +line_numbers: false +--- +cd /var/www/html + +--- /code --- + +--- /task --- + +--- task --- + +Open the `index.html` file using Thonny + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo thonny index.html + +--- /code --- + +--- /task --- + +--- task --- + +Delete the contents of the file, then type a short message and save your changes. + +--- /task --- + +--- task --- + +Go back to Chromium and refresh the browser. You will see your message appear on the web page. + +--- /task --- + +--- collapse --- +--- +title: Access the page from another device on the network +--- + +You can open your web page from any other computer on your network, using the IP address of your Raspberry Pi, e.g. `http://192.168.1.10`. + +To find out your Raspberry Pi's IP address, type `hostname -I` into the terminal window. + +--- /collapse --- diff --git a/pl-PL/step_3.md b/pl-PL/step_3.md new file mode 100644 index 0000000..4bb6e7f --- /dev/null +++ b/pl-PL/step_3.md @@ -0,0 +1,91 @@ +## Install PHP + +PHP is a **preprocessor**: it's code that runs when the server receives a request for a web page via a web browser. It works out what needs to be shown on the page, and then sends that page to the browser. + +--- task --- + +Type the following command in the terminal to install PHP: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo apt install php -y + +--- /code --- + +--- /task --- + +### Test PHP + +--- task --- + +Type this command to delete the `index.html` file from earlier: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo rm index.html + +--- /code --- + +--- /task --- + +--- task --- + +Create a new file called `index.php`: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo thonny index.php + +--- /code --- + +--- /task --- + +--- task --- + +In the Thonny code editor, type this PHP code into the file and save it. + +--- code --- +--- +language: php +line_numbers: false +--- + + +--- /code --- + +--- /task --- + +--- task --- + +Refresh your browser. You should see "hello world". This page is not dynamic, but it is still served by PHP. + +![hello world](images/apache-hello-world.png) + +--- /task --- + + +--- collapse --- +--- +title: I can only see PHP code +--- +If you see the raw PHP above instead of "hello world", use this command to reload and restart Apache: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo service apache2 restart + +--- /code --- + +--- /collapse --- diff --git a/pl-PL/step_4.md b/pl-PL/step_4.md new file mode 100644 index 0000000..cc6eae1 --- /dev/null +++ b/pl-PL/step_4.md @@ -0,0 +1,75 @@ +## Install MariaDB + +MariaDB is a popular database engine. Like PHP, it's widely used on web servers, which is why projects like WordPress use it, and why those projects are so popular. + + +--- task --- + +Type this command to install the MariaDB Server and PHP-MySQL packages: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo apt install mariadb-server php-mysql -y + +--- /code --- + +--- /task --- + +--- task --- + +Now restart Apache: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo service apache2 restart + +--- /code --- + +--- /task --- + +### Set up + +--- task --- + +Run the MySQL secure installation command in the terminal window. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo mysql_secure_installation + +--- /code --- + +--- /task --- + +--- task --- + +Go through the setup wizard using the following answers: + ++ `Enter current password for root (enter for none):` — press **Enter**. + ++ `Switch to unix_socket authentication [Y/n]` - Type in **N** and press **Enter** + ++ `Change the root password?` - Type in **Y** and press **Enter** + ++ `New password:` - Type in a password and press **Enter**, then repeat a second time. **Important:** remember this root password, as you will need it later to set up WordPress. + ++ `Remove anonymous users` - Type in **Y** + ++ `Disallow root login remotely` - Type in **Y** + ++ `Remove test database and access to it` - Type in **Y** + ++ `Reload privilege tables now` - Type in **Y** + +--- /task --- + +When complete, you will see the message `All done!` and `Thanks for using MariaDB!`. diff --git a/pl-PL/step_5.md b/pl-PL/step_5.md new file mode 100644 index 0000000..d34db90 --- /dev/null +++ b/pl-PL/step_5.md @@ -0,0 +1,109 @@ +## Download WordPress + +WordPress is a popular tool used to quickly create a website or blog with an easy to use editor for creating new content. + + +--- task --- + +In your terminal, make sure you are still in the directory `/var/www/html/` + +--- code --- +--- +language: bash +line_numbers: false +--- +cd /var/www/html/ + +--- /code --- + +--- /task --- + +--- task --- + +Delete all the files in the folder. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo rm * + +--- /code --- + +--- /task --- + +--- task --- + +Type this command to download WordPress + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo wget http://wordpress.org/latest.tar.gz + +--- /code --- + +--- /task --- + +--- task --- + +Extract the WordPress software: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo tar xzf latest.tar.gz + +--- /code --- + +--- /task --- + +--- task --- + +Move the contents of the extracted `wordpress` directory to the current directory. **Tip:** Make sure you type the whole command including the dot. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo mv wordpress/* . + +--- /code --- + +--- /task --- + +--- task --- + +Tidy up by removing the download, and the now empty `wordpress` directory. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo rm -rf wordpress latest.tar.gz + +--- /code --- + +--- /task --- + +---task --- + +Change the ownership of all these files to the Apache user: **Tip:** Make sure you type the whole command including the dot. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo chown -R www-data: . + +--- /code --- + +--- /task --- diff --git a/pl-PL/step_6.md b/pl-PL/step_6.md new file mode 100644 index 0000000..eefa5ec --- /dev/null +++ b/pl-PL/step_6.md @@ -0,0 +1,95 @@ +## Set up your WordPress Database + +--- task --- + +Run `mysql` in the terminal window: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo mysql -uroot -p + +--- /code --- + +--- /task --- + +--- task --- + +Enter the root password you created when you set up the database. + +You will see the message `Welcome to the MariaDB monitor` and then the `MariaDB [(none)]>` prompt. + +--- /task --- + +--- task --- + +At the `MariaDB [(none)]>` prompt, type: **Tip:** Don't forget to type the semicolon at the end. + +--- code --- +--- +language: sql +line_numbers: false +--- +create database wordpress; + +--- /code --- + + + +--- /task --- + +If this has been successful, you should see `Query OK, 1 row affected (0.00 sec)`. + +--- task --- + +At the MariaDB prompt, grant database privileges to the root user. Change `YOURPASSWORD` to the password you created before. + +--- code --- +--- +language: sql +line_numbers: false +--- + +GRANT ALL PRIVILEGES ON wordpress.* TO 'root'@'localhost' IDENTIFIED BY 'YOURPASSWORD'; + +--- /code --- + +--- /task --- + +--- task --- + +For the changes to take effect, you will need to flush the database privileges: + +--- code --- +--- +language: sql +line_numbers: false +--- +FLUSH PRIVILEGES; + +--- /code --- + +--- /task --- + +--- task --- + +Exit the MariaDB prompt with Ctrl + D. + +--- /task --- + +--- task --- + +Restart your Raspberry Pi by typing this command in the terminal: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo reboot + +--- /code --- + +--- /task --- diff --git a/pl-PL/step_7.md b/pl-PL/step_7.md new file mode 100644 index 0000000..be18128 --- /dev/null +++ b/pl-PL/step_7.md @@ -0,0 +1,155 @@ +## WordPress configuration + +--- task --- + +Once your Raspberry Pi has rebooted, open Chromium and type `localhost` into the address bar. + +You should see a WordPress page asking to pick your language. + +![WordPress select language](images/wordpress_language.png) + +--- /task --- + +--- task --- + +Select your language and click **Continue**. + +--- /task --- + +You will be presented with the WordPress welcome screen. + +![WordPress welcome screen](images/wordpress-welcome.png) + +--- task --- + +Click the **Let's go!** button. + +--- /task --- + +--- task --- + +Now fill out the basic site information as follows: **Tip:** Make sure you type `wordpress` in the first box as the text displayed is only a suggestion, the box is blank. + +``` +Database Name: wordpress +User Name: root +Password: +Database Host: localhost +Table Prefix: wp_ +``` + +Click **Submit** to proceed. + +--- /task --- + + +--- task --- + +Click the **Run the install** button. + +--- /task --- + +--- task --- + +Fill in the information you are asked for, then click the `Install WordPress` button. + +--- /task --- + +--- task --- + +Log in, using the account you just created. + +Now you're logged in and have your site set up, you can see the website by visiting your `http://localhost/wp-admin`. + +--- /task --- + + +### Friendly permalinks + +It's recommended that you change your permalink settings to make your URLs more friendly. + +--- task --- + +Log in to WordPress and go to the dashboard. + +--- /task --- + +--- task --- + +Go to **Setting**, then **Permalinks**. + +--- /task --- + +--- task --- + +Select the **Post name** option and click **Save Changes**. + +--- /task --- + +--- task --- + +Type the following command in a terminal to enable Apache's `rewrite` mod: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo a2enmod rewrite + +--- /code --- + +--- /task --- + +--- task --- + +Open the Apache configuration file + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo geany /etc/apache2/sites-available/000-default.conf + +--- /code --- + +--- /task --- + +--- task --- + +Add the following lines after line 1. + +--- code --- +--- +language: sql line_numbers: true line_number_start: 2 +line_highlights: 3-5 +--- + AllowOverride All + +--- /code --- + +--- /task --- + +--- task --- + +Save the file and close Geany. + +--- /task --- + +--- task --- + +In a terminal type the command to restart Apache: + + + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo service apache2 restart + +--- /code --- + +--- /task --- \ No newline at end of file diff --git a/pl-PL/step_8.md b/pl-PL/step_8.md new file mode 100644 index 0000000..2e023a0 --- /dev/null +++ b/pl-PL/step_8.md @@ -0,0 +1,17 @@ +## Challenge + +--- challenge --- + +--- task --- + +Add more pages to your website. + +--- /task --- + +--- task --- + +Install a different theme from the Appearance menu. + +--- /task --- + +--- /challenge --- diff --git a/pl-PL/step_9.md b/pl-PL/step_9.md new file mode 100644 index 0000000..fc5847a --- /dev/null +++ b/pl-PL/step_9.md @@ -0,0 +1,3 @@ +## What can you do now? + +You could try setting up a [Python web server with Flask](https://projects.raspberrypi.org/en/projects/python-web-server-with-flask) \ No newline at end of file diff --git a/pt-BR/images/Python-Webserver-with-Wordpress-TILE-01.png b/pt-BR/images/Python-Webserver-with-Wordpress-TILE-01.png new file mode 100644 index 0000000..f632634 Binary files /dev/null and b/pt-BR/images/Python-Webserver-with-Wordpress-TILE-01.png differ diff --git a/pt-BR/images/Python-Webserver-with-Wordpress.png b/pt-BR/images/Python-Webserver-with-Wordpress.png new file mode 100644 index 0000000..07b0191 Binary files /dev/null and b/pt-BR/images/Python-Webserver-with-Wordpress.png differ diff --git a/pt-BR/images/apache-hello-world.png b/pt-BR/images/apache-hello-world.png new file mode 100644 index 0000000..69fb339 Binary files /dev/null and b/pt-BR/images/apache-hello-world.png differ diff --git a/pt-BR/images/apache-it-works.png b/pt-BR/images/apache-it-works.png new file mode 100644 index 0000000..fb71d9f Binary files /dev/null and b/pt-BR/images/apache-it-works.png differ diff --git a/pt-BR/images/banner.png b/pt-BR/images/banner.png new file mode 100644 index 0000000..88a7bfb Binary files /dev/null and b/pt-BR/images/banner.png differ diff --git a/pt-BR/images/create-database.png b/pt-BR/images/create-database.png new file mode 100644 index 0000000..34c91f2 Binary files /dev/null and b/pt-BR/images/create-database.png differ diff --git a/pt-BR/images/hostname.png b/pt-BR/images/hostname.png new file mode 100644 index 0000000..bb50249 Binary files /dev/null and b/pt-BR/images/hostname.png differ diff --git a/pt-BR/images/hostname_annotated.png b/pt-BR/images/hostname_annotated.png new file mode 100644 index 0000000..27b2f08 Binary files /dev/null and b/pt-BR/images/hostname_annotated.png differ diff --git a/pt-BR/images/install_apache.png b/pt-BR/images/install_apache.png new file mode 100644 index 0000000..8b5dab8 Binary files /dev/null and b/pt-BR/images/install_apache.png differ diff --git a/pt-BR/images/wordpress-database-setup.png b/pt-BR/images/wordpress-database-setup.png new file mode 100644 index 0000000..a1b2a91 Binary files /dev/null and b/pt-BR/images/wordpress-database-setup.png differ diff --git a/pt-BR/images/wordpress-information_needed.png b/pt-BR/images/wordpress-information_needed.png new file mode 100644 index 0000000..8119d0a Binary files /dev/null and b/pt-BR/images/wordpress-information_needed.png differ diff --git a/pt-BR/images/wordpress-run-installation.png b/pt-BR/images/wordpress-run-installation.png new file mode 100644 index 0000000..b368d00 Binary files /dev/null and b/pt-BR/images/wordpress-run-installation.png differ diff --git a/pt-BR/images/wordpress-welcome.png b/pt-BR/images/wordpress-welcome.png new file mode 100644 index 0000000..9394739 Binary files /dev/null and b/pt-BR/images/wordpress-welcome.png differ diff --git a/pt-BR/images/wordpress_language.png b/pt-BR/images/wordpress_language.png new file mode 100644 index 0000000..4d44ba3 Binary files /dev/null and b/pt-BR/images/wordpress_language.png differ diff --git a/pt-BR/images/wp-info.png b/pt-BR/images/wp-info.png new file mode 100644 index 0000000..032e62e Binary files /dev/null and b/pt-BR/images/wp-info.png differ diff --git a/pt-BR/meta.yml b/pt-BR/meta.yml new file mode 100644 index 0000000..522db60 --- /dev/null +++ b/pt-BR/meta.yml @@ -0,0 +1,42 @@ +--- +title: Build a LAMP Web Server with WordPress +hero_image: images/banner.png +description: Set up a local server for a website on your Raspberry Pi +original_url: https://raspberrypi.org/learning/lamp-web-server-with-wordpress +theme: turquoise +duration: 2 +listed: true +ingredient: false +copyedit: false +curriculum: 3, design-0, programming-3, phys-comp-0, manufacture-0, community-0 +interests: '' +technologies: raspberry-pi, html-css-javascript +site_areas: projects +hardware: raspberry-pi +software: html-css-javascript +version: 4 +last_tested: 01/01/2017 +steps: + - + title: Introdução + - + title: Set up an Apache web server + completion: + - engaged + - + title: Install PHP + - + title: Install MariaDB + - + title: Download WordPress + - + title: Set up your WordPress database + completion: + - internal + - + title: WordPress configuration + completion: + - external + - + title: Challenge + challenge: true diff --git a/pt-BR/step_1.md b/pt-BR/step_1.md new file mode 100644 index 0000000..21c93ee --- /dev/null +++ b/pt-BR/step_1.md @@ -0,0 +1,12 @@ +## O que você vai fazer +Learn to set up a LAMP (**L**inux, **A**pache, **M**ySQL, **P**HP) stack on your Raspberry Pi and configure it to work as a web server. + + - Install software on your Raspberry Pi + - Install and configure Apache, PHP, and MySQL to create a LAMP web server + - Download WordPress and run it as a local website on your Raspberry Pi + - Configure WordPress and make your website accessible to other devices on your local network + + +### You will need +- A Raspberry Pi computer connected to the internet +- [An up to date install of the Raspberry Pi OS](https://www.raspberrypi.org/downloads/) diff --git a/pt-BR/step_2.md b/pt-BR/step_2.md new file mode 100644 index 0000000..1cb6c47 --- /dev/null +++ b/pt-BR/step_2.md @@ -0,0 +1,110 @@ +## Set up an Apache web server + +Apache is a popular web server application you can install on the Raspberry Pi to allow it to serve web pages. + +On its own, Apache can serve HTML files over HTTP. With additional modules it can serve dynamic web pages using scripting languages such as PHP. + +### Install Apache + +--- task --- + +Open a terminal window by selecting **Accessories** > **Terminal** from the menu. + +--- /task --- + +--- task --- + +Type the following command into the terminal and press Enter to install `apache2` + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo apt install apache2 -y + +--- /code --- + +**Tip:** If you see an error, make sure you are using the latest version of Raspberry Pi OS. + +--- /task --- + + +### Test the web server + +By default, Apache puts a test HTML file in the web folder that you will be able to view from your Pi or another computer on your network. + +--- task --- + +Open Chromium by selecting **Internet** > **Chromium Web Browser** from the menu. + +--- /task --- + +--- task --- + +Type `localhost` in the address bar. + +--- /task --- + +You should see this in your browser window: + +![Apache it works](images/apache-it-works.png) + +This means you have Apache working! + +### Changing the default web page + +This default web page is just a HTML file on the file system. It is located at `/var/www/html/index.html`. + +--- task --- + +Type the following command in the terminal to change to the directory containing the HTML file: + +--- code --- +--- +language: bash +line_numbers: false +--- +cd /var/www/html + +--- /code --- + +--- /task --- + +--- task --- + +Open the `index.html` file using Thonny + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo thonny index.html + +--- /code --- + +--- /task --- + +--- task --- + +Delete the contents of the file, then type a short message and save your changes. + +--- /task --- + +--- task --- + +Go back to Chromium and refresh the browser. You will see your message appear on the web page. + +--- /task --- + +--- collapse --- +--- +title: Access the page from another device on the network +--- + +You can open your web page from any other computer on your network, using the IP address of your Raspberry Pi, e.g. `http://192.168.1.10`. + +To find out your Raspberry Pi's IP address, type `hostname -I` into the terminal window. + +--- /collapse --- diff --git a/pt-BR/step_3.md b/pt-BR/step_3.md new file mode 100644 index 0000000..4bb6e7f --- /dev/null +++ b/pt-BR/step_3.md @@ -0,0 +1,91 @@ +## Install PHP + +PHP is a **preprocessor**: it's code that runs when the server receives a request for a web page via a web browser. It works out what needs to be shown on the page, and then sends that page to the browser. + +--- task --- + +Type the following command in the terminal to install PHP: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo apt install php -y + +--- /code --- + +--- /task --- + +### Test PHP + +--- task --- + +Type this command to delete the `index.html` file from earlier: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo rm index.html + +--- /code --- + +--- /task --- + +--- task --- + +Create a new file called `index.php`: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo thonny index.php + +--- /code --- + +--- /task --- + +--- task --- + +In the Thonny code editor, type this PHP code into the file and save it. + +--- code --- +--- +language: php +line_numbers: false +--- + + +--- /code --- + +--- /task --- + +--- task --- + +Refresh your browser. You should see "hello world". This page is not dynamic, but it is still served by PHP. + +![hello world](images/apache-hello-world.png) + +--- /task --- + + +--- collapse --- +--- +title: I can only see PHP code +--- +If you see the raw PHP above instead of "hello world", use this command to reload and restart Apache: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo service apache2 restart + +--- /code --- + +--- /collapse --- diff --git a/pt-BR/step_4.md b/pt-BR/step_4.md new file mode 100644 index 0000000..cc6eae1 --- /dev/null +++ b/pt-BR/step_4.md @@ -0,0 +1,75 @@ +## Install MariaDB + +MariaDB is a popular database engine. Like PHP, it's widely used on web servers, which is why projects like WordPress use it, and why those projects are so popular. + + +--- task --- + +Type this command to install the MariaDB Server and PHP-MySQL packages: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo apt install mariadb-server php-mysql -y + +--- /code --- + +--- /task --- + +--- task --- + +Now restart Apache: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo service apache2 restart + +--- /code --- + +--- /task --- + +### Set up + +--- task --- + +Run the MySQL secure installation command in the terminal window. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo mysql_secure_installation + +--- /code --- + +--- /task --- + +--- task --- + +Go through the setup wizard using the following answers: + ++ `Enter current password for root (enter for none):` — press **Enter**. + ++ `Switch to unix_socket authentication [Y/n]` - Type in **N** and press **Enter** + ++ `Change the root password?` - Type in **Y** and press **Enter** + ++ `New password:` - Type in a password and press **Enter**, then repeat a second time. **Important:** remember this root password, as you will need it later to set up WordPress. + ++ `Remove anonymous users` - Type in **Y** + ++ `Disallow root login remotely` - Type in **Y** + ++ `Remove test database and access to it` - Type in **Y** + ++ `Reload privilege tables now` - Type in **Y** + +--- /task --- + +When complete, you will see the message `All done!` and `Thanks for using MariaDB!`. diff --git a/pt-BR/step_5.md b/pt-BR/step_5.md new file mode 100644 index 0000000..d34db90 --- /dev/null +++ b/pt-BR/step_5.md @@ -0,0 +1,109 @@ +## Download WordPress + +WordPress is a popular tool used to quickly create a website or blog with an easy to use editor for creating new content. + + +--- task --- + +In your terminal, make sure you are still in the directory `/var/www/html/` + +--- code --- +--- +language: bash +line_numbers: false +--- +cd /var/www/html/ + +--- /code --- + +--- /task --- + +--- task --- + +Delete all the files in the folder. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo rm * + +--- /code --- + +--- /task --- + +--- task --- + +Type this command to download WordPress + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo wget http://wordpress.org/latest.tar.gz + +--- /code --- + +--- /task --- + +--- task --- + +Extract the WordPress software: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo tar xzf latest.tar.gz + +--- /code --- + +--- /task --- + +--- task --- + +Move the contents of the extracted `wordpress` directory to the current directory. **Tip:** Make sure you type the whole command including the dot. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo mv wordpress/* . + +--- /code --- + +--- /task --- + +--- task --- + +Tidy up by removing the download, and the now empty `wordpress` directory. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo rm -rf wordpress latest.tar.gz + +--- /code --- + +--- /task --- + +---task --- + +Change the ownership of all these files to the Apache user: **Tip:** Make sure you type the whole command including the dot. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo chown -R www-data: . + +--- /code --- + +--- /task --- diff --git a/pt-BR/step_6.md b/pt-BR/step_6.md new file mode 100644 index 0000000..eefa5ec --- /dev/null +++ b/pt-BR/step_6.md @@ -0,0 +1,95 @@ +## Set up your WordPress Database + +--- task --- + +Run `mysql` in the terminal window: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo mysql -uroot -p + +--- /code --- + +--- /task --- + +--- task --- + +Enter the root password you created when you set up the database. + +You will see the message `Welcome to the MariaDB monitor` and then the `MariaDB [(none)]>` prompt. + +--- /task --- + +--- task --- + +At the `MariaDB [(none)]>` prompt, type: **Tip:** Don't forget to type the semicolon at the end. + +--- code --- +--- +language: sql +line_numbers: false +--- +create database wordpress; + +--- /code --- + + + +--- /task --- + +If this has been successful, you should see `Query OK, 1 row affected (0.00 sec)`. + +--- task --- + +At the MariaDB prompt, grant database privileges to the root user. Change `YOURPASSWORD` to the password you created before. + +--- code --- +--- +language: sql +line_numbers: false +--- + +GRANT ALL PRIVILEGES ON wordpress.* TO 'root'@'localhost' IDENTIFIED BY 'YOURPASSWORD'; + +--- /code --- + +--- /task --- + +--- task --- + +For the changes to take effect, you will need to flush the database privileges: + +--- code --- +--- +language: sql +line_numbers: false +--- +FLUSH PRIVILEGES; + +--- /code --- + +--- /task --- + +--- task --- + +Exit the MariaDB prompt with Ctrl + D. + +--- /task --- + +--- task --- + +Restart your Raspberry Pi by typing this command in the terminal: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo reboot + +--- /code --- + +--- /task --- diff --git a/pt-BR/step_7.md b/pt-BR/step_7.md new file mode 100644 index 0000000..be18128 --- /dev/null +++ b/pt-BR/step_7.md @@ -0,0 +1,155 @@ +## WordPress configuration + +--- task --- + +Once your Raspberry Pi has rebooted, open Chromium and type `localhost` into the address bar. + +You should see a WordPress page asking to pick your language. + +![WordPress select language](images/wordpress_language.png) + +--- /task --- + +--- task --- + +Select your language and click **Continue**. + +--- /task --- + +You will be presented with the WordPress welcome screen. + +![WordPress welcome screen](images/wordpress-welcome.png) + +--- task --- + +Click the **Let's go!** button. + +--- /task --- + +--- task --- + +Now fill out the basic site information as follows: **Tip:** Make sure you type `wordpress` in the first box as the text displayed is only a suggestion, the box is blank. + +``` +Database Name: wordpress +User Name: root +Password: +Database Host: localhost +Table Prefix: wp_ +``` + +Click **Submit** to proceed. + +--- /task --- + + +--- task --- + +Click the **Run the install** button. + +--- /task --- + +--- task --- + +Fill in the information you are asked for, then click the `Install WordPress` button. + +--- /task --- + +--- task --- + +Log in, using the account you just created. + +Now you're logged in and have your site set up, you can see the website by visiting your `http://localhost/wp-admin`. + +--- /task --- + + +### Friendly permalinks + +It's recommended that you change your permalink settings to make your URLs more friendly. + +--- task --- + +Log in to WordPress and go to the dashboard. + +--- /task --- + +--- task --- + +Go to **Setting**, then **Permalinks**. + +--- /task --- + +--- task --- + +Select the **Post name** option and click **Save Changes**. + +--- /task --- + +--- task --- + +Type the following command in a terminal to enable Apache's `rewrite` mod: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo a2enmod rewrite + +--- /code --- + +--- /task --- + +--- task --- + +Open the Apache configuration file + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo geany /etc/apache2/sites-available/000-default.conf + +--- /code --- + +--- /task --- + +--- task --- + +Add the following lines after line 1. + +--- code --- +--- +language: sql line_numbers: true line_number_start: 2 +line_highlights: 3-5 +--- + AllowOverride All + +--- /code --- + +--- /task --- + +--- task --- + +Save the file and close Geany. + +--- /task --- + +--- task --- + +In a terminal type the command to restart Apache: + + + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo service apache2 restart + +--- /code --- + +--- /task --- \ No newline at end of file diff --git a/pt-BR/step_8.md b/pt-BR/step_8.md new file mode 100644 index 0000000..2e023a0 --- /dev/null +++ b/pt-BR/step_8.md @@ -0,0 +1,17 @@ +## Challenge + +--- challenge --- + +--- task --- + +Add more pages to your website. + +--- /task --- + +--- task --- + +Install a different theme from the Appearance menu. + +--- /task --- + +--- /challenge --- diff --git a/pt-BR/step_9.md b/pt-BR/step_9.md new file mode 100644 index 0000000..fc5847a --- /dev/null +++ b/pt-BR/step_9.md @@ -0,0 +1,3 @@ +## What can you do now? + +You could try setting up a [Python web server with Flask](https://projects.raspberrypi.org/en/projects/python-web-server-with-flask) \ No newline at end of file diff --git a/pt-PT/images/Python-Webserver-with-Wordpress-TILE-01.png b/pt-PT/images/Python-Webserver-with-Wordpress-TILE-01.png new file mode 100644 index 0000000..f632634 Binary files /dev/null and b/pt-PT/images/Python-Webserver-with-Wordpress-TILE-01.png differ diff --git a/pt-PT/images/Python-Webserver-with-Wordpress.png b/pt-PT/images/Python-Webserver-with-Wordpress.png new file mode 100644 index 0000000..07b0191 Binary files /dev/null and b/pt-PT/images/Python-Webserver-with-Wordpress.png differ diff --git a/pt-PT/images/apache-hello-world.png b/pt-PT/images/apache-hello-world.png new file mode 100644 index 0000000..69fb339 Binary files /dev/null and b/pt-PT/images/apache-hello-world.png differ diff --git a/pt-PT/images/apache-it-works.png b/pt-PT/images/apache-it-works.png new file mode 100644 index 0000000..fb71d9f Binary files /dev/null and b/pt-PT/images/apache-it-works.png differ diff --git a/pt-PT/images/banner.png b/pt-PT/images/banner.png new file mode 100644 index 0000000..88a7bfb Binary files /dev/null and b/pt-PT/images/banner.png differ diff --git a/pt-PT/images/create-database.png b/pt-PT/images/create-database.png new file mode 100644 index 0000000..34c91f2 Binary files /dev/null and b/pt-PT/images/create-database.png differ diff --git a/pt-PT/images/hostname.png b/pt-PT/images/hostname.png new file mode 100644 index 0000000..bb50249 Binary files /dev/null and b/pt-PT/images/hostname.png differ diff --git a/pt-PT/images/hostname_annotated.png b/pt-PT/images/hostname_annotated.png new file mode 100644 index 0000000..27b2f08 Binary files /dev/null and b/pt-PT/images/hostname_annotated.png differ diff --git a/pt-PT/images/install_apache.png b/pt-PT/images/install_apache.png new file mode 100644 index 0000000..8b5dab8 Binary files /dev/null and b/pt-PT/images/install_apache.png differ diff --git a/pt-PT/images/wordpress-database-setup.png b/pt-PT/images/wordpress-database-setup.png new file mode 100644 index 0000000..a1b2a91 Binary files /dev/null and b/pt-PT/images/wordpress-database-setup.png differ diff --git a/pt-PT/images/wordpress-information_needed.png b/pt-PT/images/wordpress-information_needed.png new file mode 100644 index 0000000..8119d0a Binary files /dev/null and b/pt-PT/images/wordpress-information_needed.png differ diff --git a/pt-PT/images/wordpress-run-installation.png b/pt-PT/images/wordpress-run-installation.png new file mode 100644 index 0000000..b368d00 Binary files /dev/null and b/pt-PT/images/wordpress-run-installation.png differ diff --git a/pt-PT/images/wordpress-welcome.png b/pt-PT/images/wordpress-welcome.png new file mode 100644 index 0000000..9394739 Binary files /dev/null and b/pt-PT/images/wordpress-welcome.png differ diff --git a/pt-PT/images/wordpress_language.png b/pt-PT/images/wordpress_language.png new file mode 100644 index 0000000..4d44ba3 Binary files /dev/null and b/pt-PT/images/wordpress_language.png differ diff --git a/pt-PT/images/wp-info.png b/pt-PT/images/wp-info.png new file mode 100644 index 0000000..032e62e Binary files /dev/null and b/pt-PT/images/wp-info.png differ diff --git a/pt-PT/meta.yml b/pt-PT/meta.yml new file mode 100644 index 0000000..90f571f --- /dev/null +++ b/pt-PT/meta.yml @@ -0,0 +1,42 @@ +--- +title: Build a LAMP Web Server with WordPress +hero_image: images/banner.png +description: Set up a local server for a website on your Raspberry Pi +original_url: https://raspberrypi.org/learning/lamp-web-server-with-wordpress +theme: turquoise +duration: 2 +listed: true +ingredient: false +copyedit: false +curriculum: 3, design-0, programming-3, phys-comp-0, manufacture-0, community-0 +interests: '' +technologies: raspberry-pi, html-css-javascript +site_areas: projetos +hardware: raspberry-pi +software: html-css-javascript +version: 4 +last_tested: 2017-01-01 +steps: + - + title: Introdução + - + title: Set up an Apache web server + completion: + - engaged + - + title: Install PHP + - + title: Install MariaDB + - + title: Download WordPress + - + title: Set up your WordPress database + completion: + - internal + - + title: WordPress configuration + completion: + - external + - + title: Challenge + challenge: true diff --git a/pt-PT/step_1.md b/pt-PT/step_1.md new file mode 100644 index 0000000..2cb605e --- /dev/null +++ b/pt-PT/step_1.md @@ -0,0 +1,12 @@ +## O que vais fazer +Learn to set up a LAMP (**L**inux, **A**pache, **M**ySQL, **P**HP) stack on your Raspberry Pi and configure it to work as a web server. + + - Install software on your Raspberry Pi + - Install and configure Apache, PHP, and MySQL to create a LAMP web server + - Download WordPress and run it as a local website on your Raspberry Pi + - Configure WordPress and make your website accessible to other devices on your local network + + +### You will need +- A Raspberry Pi computer connected to the internet +- [An up to date install of the Raspberry Pi OS](https://www.raspberrypi.org/downloads/) diff --git a/pt-PT/step_2.md b/pt-PT/step_2.md new file mode 100644 index 0000000..1cb6c47 --- /dev/null +++ b/pt-PT/step_2.md @@ -0,0 +1,110 @@ +## Set up an Apache web server + +Apache is a popular web server application you can install on the Raspberry Pi to allow it to serve web pages. + +On its own, Apache can serve HTML files over HTTP. With additional modules it can serve dynamic web pages using scripting languages such as PHP. + +### Install Apache + +--- task --- + +Open a terminal window by selecting **Accessories** > **Terminal** from the menu. + +--- /task --- + +--- task --- + +Type the following command into the terminal and press Enter to install `apache2` + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo apt install apache2 -y + +--- /code --- + +**Tip:** If you see an error, make sure you are using the latest version of Raspberry Pi OS. + +--- /task --- + + +### Test the web server + +By default, Apache puts a test HTML file in the web folder that you will be able to view from your Pi or another computer on your network. + +--- task --- + +Open Chromium by selecting **Internet** > **Chromium Web Browser** from the menu. + +--- /task --- + +--- task --- + +Type `localhost` in the address bar. + +--- /task --- + +You should see this in your browser window: + +![Apache it works](images/apache-it-works.png) + +This means you have Apache working! + +### Changing the default web page + +This default web page is just a HTML file on the file system. It is located at `/var/www/html/index.html`. + +--- task --- + +Type the following command in the terminal to change to the directory containing the HTML file: + +--- code --- +--- +language: bash +line_numbers: false +--- +cd /var/www/html + +--- /code --- + +--- /task --- + +--- task --- + +Open the `index.html` file using Thonny + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo thonny index.html + +--- /code --- + +--- /task --- + +--- task --- + +Delete the contents of the file, then type a short message and save your changes. + +--- /task --- + +--- task --- + +Go back to Chromium and refresh the browser. You will see your message appear on the web page. + +--- /task --- + +--- collapse --- +--- +title: Access the page from another device on the network +--- + +You can open your web page from any other computer on your network, using the IP address of your Raspberry Pi, e.g. `http://192.168.1.10`. + +To find out your Raspberry Pi's IP address, type `hostname -I` into the terminal window. + +--- /collapse --- diff --git a/pt-PT/step_3.md b/pt-PT/step_3.md new file mode 100644 index 0000000..4bb6e7f --- /dev/null +++ b/pt-PT/step_3.md @@ -0,0 +1,91 @@ +## Install PHP + +PHP is a **preprocessor**: it's code that runs when the server receives a request for a web page via a web browser. It works out what needs to be shown on the page, and then sends that page to the browser. + +--- task --- + +Type the following command in the terminal to install PHP: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo apt install php -y + +--- /code --- + +--- /task --- + +### Test PHP + +--- task --- + +Type this command to delete the `index.html` file from earlier: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo rm index.html + +--- /code --- + +--- /task --- + +--- task --- + +Create a new file called `index.php`: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo thonny index.php + +--- /code --- + +--- /task --- + +--- task --- + +In the Thonny code editor, type this PHP code into the file and save it. + +--- code --- +--- +language: php +line_numbers: false +--- + + +--- /code --- + +--- /task --- + +--- task --- + +Refresh your browser. You should see "hello world". This page is not dynamic, but it is still served by PHP. + +![hello world](images/apache-hello-world.png) + +--- /task --- + + +--- collapse --- +--- +title: I can only see PHP code +--- +If you see the raw PHP above instead of "hello world", use this command to reload and restart Apache: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo service apache2 restart + +--- /code --- + +--- /collapse --- diff --git a/pt-PT/step_4.md b/pt-PT/step_4.md new file mode 100644 index 0000000..cc6eae1 --- /dev/null +++ b/pt-PT/step_4.md @@ -0,0 +1,75 @@ +## Install MariaDB + +MariaDB is a popular database engine. Like PHP, it's widely used on web servers, which is why projects like WordPress use it, and why those projects are so popular. + + +--- task --- + +Type this command to install the MariaDB Server and PHP-MySQL packages: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo apt install mariadb-server php-mysql -y + +--- /code --- + +--- /task --- + +--- task --- + +Now restart Apache: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo service apache2 restart + +--- /code --- + +--- /task --- + +### Set up + +--- task --- + +Run the MySQL secure installation command in the terminal window. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo mysql_secure_installation + +--- /code --- + +--- /task --- + +--- task --- + +Go through the setup wizard using the following answers: + ++ `Enter current password for root (enter for none):` — press **Enter**. + ++ `Switch to unix_socket authentication [Y/n]` - Type in **N** and press **Enter** + ++ `Change the root password?` - Type in **Y** and press **Enter** + ++ `New password:` - Type in a password and press **Enter**, then repeat a second time. **Important:** remember this root password, as you will need it later to set up WordPress. + ++ `Remove anonymous users` - Type in **Y** + ++ `Disallow root login remotely` - Type in **Y** + ++ `Remove test database and access to it` - Type in **Y** + ++ `Reload privilege tables now` - Type in **Y** + +--- /task --- + +When complete, you will see the message `All done!` and `Thanks for using MariaDB!`. diff --git a/pt-PT/step_5.md b/pt-PT/step_5.md new file mode 100644 index 0000000..d34db90 --- /dev/null +++ b/pt-PT/step_5.md @@ -0,0 +1,109 @@ +## Download WordPress + +WordPress is a popular tool used to quickly create a website or blog with an easy to use editor for creating new content. + + +--- task --- + +In your terminal, make sure you are still in the directory `/var/www/html/` + +--- code --- +--- +language: bash +line_numbers: false +--- +cd /var/www/html/ + +--- /code --- + +--- /task --- + +--- task --- + +Delete all the files in the folder. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo rm * + +--- /code --- + +--- /task --- + +--- task --- + +Type this command to download WordPress + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo wget http://wordpress.org/latest.tar.gz + +--- /code --- + +--- /task --- + +--- task --- + +Extract the WordPress software: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo tar xzf latest.tar.gz + +--- /code --- + +--- /task --- + +--- task --- + +Move the contents of the extracted `wordpress` directory to the current directory. **Tip:** Make sure you type the whole command including the dot. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo mv wordpress/* . + +--- /code --- + +--- /task --- + +--- task --- + +Tidy up by removing the download, and the now empty `wordpress` directory. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo rm -rf wordpress latest.tar.gz + +--- /code --- + +--- /task --- + +---task --- + +Change the ownership of all these files to the Apache user: **Tip:** Make sure you type the whole command including the dot. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo chown -R www-data: . + +--- /code --- + +--- /task --- diff --git a/pt-PT/step_6.md b/pt-PT/step_6.md new file mode 100644 index 0000000..eefa5ec --- /dev/null +++ b/pt-PT/step_6.md @@ -0,0 +1,95 @@ +## Set up your WordPress Database + +--- task --- + +Run `mysql` in the terminal window: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo mysql -uroot -p + +--- /code --- + +--- /task --- + +--- task --- + +Enter the root password you created when you set up the database. + +You will see the message `Welcome to the MariaDB monitor` and then the `MariaDB [(none)]>` prompt. + +--- /task --- + +--- task --- + +At the `MariaDB [(none)]>` prompt, type: **Tip:** Don't forget to type the semicolon at the end. + +--- code --- +--- +language: sql +line_numbers: false +--- +create database wordpress; + +--- /code --- + + + +--- /task --- + +If this has been successful, you should see `Query OK, 1 row affected (0.00 sec)`. + +--- task --- + +At the MariaDB prompt, grant database privileges to the root user. Change `YOURPASSWORD` to the password you created before. + +--- code --- +--- +language: sql +line_numbers: false +--- + +GRANT ALL PRIVILEGES ON wordpress.* TO 'root'@'localhost' IDENTIFIED BY 'YOURPASSWORD'; + +--- /code --- + +--- /task --- + +--- task --- + +For the changes to take effect, you will need to flush the database privileges: + +--- code --- +--- +language: sql +line_numbers: false +--- +FLUSH PRIVILEGES; + +--- /code --- + +--- /task --- + +--- task --- + +Exit the MariaDB prompt with Ctrl + D. + +--- /task --- + +--- task --- + +Restart your Raspberry Pi by typing this command in the terminal: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo reboot + +--- /code --- + +--- /task --- diff --git a/pt-PT/step_7.md b/pt-PT/step_7.md new file mode 100644 index 0000000..be18128 --- /dev/null +++ b/pt-PT/step_7.md @@ -0,0 +1,155 @@ +## WordPress configuration + +--- task --- + +Once your Raspberry Pi has rebooted, open Chromium and type `localhost` into the address bar. + +You should see a WordPress page asking to pick your language. + +![WordPress select language](images/wordpress_language.png) + +--- /task --- + +--- task --- + +Select your language and click **Continue**. + +--- /task --- + +You will be presented with the WordPress welcome screen. + +![WordPress welcome screen](images/wordpress-welcome.png) + +--- task --- + +Click the **Let's go!** button. + +--- /task --- + +--- task --- + +Now fill out the basic site information as follows: **Tip:** Make sure you type `wordpress` in the first box as the text displayed is only a suggestion, the box is blank. + +``` +Database Name: wordpress +User Name: root +Password: +Database Host: localhost +Table Prefix: wp_ +``` + +Click **Submit** to proceed. + +--- /task --- + + +--- task --- + +Click the **Run the install** button. + +--- /task --- + +--- task --- + +Fill in the information you are asked for, then click the `Install WordPress` button. + +--- /task --- + +--- task --- + +Log in, using the account you just created. + +Now you're logged in and have your site set up, you can see the website by visiting your `http://localhost/wp-admin`. + +--- /task --- + + +### Friendly permalinks + +It's recommended that you change your permalink settings to make your URLs more friendly. + +--- task --- + +Log in to WordPress and go to the dashboard. + +--- /task --- + +--- task --- + +Go to **Setting**, then **Permalinks**. + +--- /task --- + +--- task --- + +Select the **Post name** option and click **Save Changes**. + +--- /task --- + +--- task --- + +Type the following command in a terminal to enable Apache's `rewrite` mod: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo a2enmod rewrite + +--- /code --- + +--- /task --- + +--- task --- + +Open the Apache configuration file + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo geany /etc/apache2/sites-available/000-default.conf + +--- /code --- + +--- /task --- + +--- task --- + +Add the following lines after line 1. + +--- code --- +--- +language: sql line_numbers: true line_number_start: 2 +line_highlights: 3-5 +--- + AllowOverride All + +--- /code --- + +--- /task --- + +--- task --- + +Save the file and close Geany. + +--- /task --- + +--- task --- + +In a terminal type the command to restart Apache: + + + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo service apache2 restart + +--- /code --- + +--- /task --- \ No newline at end of file diff --git a/pt-PT/step_8.md b/pt-PT/step_8.md new file mode 100644 index 0000000..2e023a0 --- /dev/null +++ b/pt-PT/step_8.md @@ -0,0 +1,17 @@ +## Challenge + +--- challenge --- + +--- task --- + +Add more pages to your website. + +--- /task --- + +--- task --- + +Install a different theme from the Appearance menu. + +--- /task --- + +--- /challenge --- diff --git a/pt-PT/step_9.md b/pt-PT/step_9.md new file mode 100644 index 0000000..fc5847a --- /dev/null +++ b/pt-PT/step_9.md @@ -0,0 +1,3 @@ +## What can you do now? + +You could try setting up a [Python web server with Flask](https://projects.raspberrypi.org/en/projects/python-web-server-with-flask) \ No newline at end of file diff --git a/ro-RO/images/Python-Webserver-with-Wordpress-TILE-01.png b/ro-RO/images/Python-Webserver-with-Wordpress-TILE-01.png new file mode 100644 index 0000000..f632634 Binary files /dev/null and b/ro-RO/images/Python-Webserver-with-Wordpress-TILE-01.png differ diff --git a/ro-RO/images/Python-Webserver-with-Wordpress.png b/ro-RO/images/Python-Webserver-with-Wordpress.png new file mode 100644 index 0000000..07b0191 Binary files /dev/null and b/ro-RO/images/Python-Webserver-with-Wordpress.png differ diff --git a/ro-RO/images/apache-hello-world.png b/ro-RO/images/apache-hello-world.png new file mode 100644 index 0000000..69fb339 Binary files /dev/null and b/ro-RO/images/apache-hello-world.png differ diff --git a/ro-RO/images/apache-it-works.png b/ro-RO/images/apache-it-works.png new file mode 100644 index 0000000..fb71d9f Binary files /dev/null and b/ro-RO/images/apache-it-works.png differ diff --git a/ro-RO/images/banner.png b/ro-RO/images/banner.png new file mode 100644 index 0000000..88a7bfb Binary files /dev/null and b/ro-RO/images/banner.png differ diff --git a/ro-RO/images/create-database.png b/ro-RO/images/create-database.png new file mode 100644 index 0000000..34c91f2 Binary files /dev/null and b/ro-RO/images/create-database.png differ diff --git a/ro-RO/images/hostname.png b/ro-RO/images/hostname.png new file mode 100644 index 0000000..bb50249 Binary files /dev/null and b/ro-RO/images/hostname.png differ diff --git a/ro-RO/images/hostname_annotated.png b/ro-RO/images/hostname_annotated.png new file mode 100644 index 0000000..27b2f08 Binary files /dev/null and b/ro-RO/images/hostname_annotated.png differ diff --git a/ro-RO/images/install_apache.png b/ro-RO/images/install_apache.png new file mode 100644 index 0000000..8b5dab8 Binary files /dev/null and b/ro-RO/images/install_apache.png differ diff --git a/ro-RO/images/wordpress-database-setup.png b/ro-RO/images/wordpress-database-setup.png new file mode 100644 index 0000000..a1b2a91 Binary files /dev/null and b/ro-RO/images/wordpress-database-setup.png differ diff --git a/ro-RO/images/wordpress-information_needed.png b/ro-RO/images/wordpress-information_needed.png new file mode 100644 index 0000000..8119d0a Binary files /dev/null and b/ro-RO/images/wordpress-information_needed.png differ diff --git a/ro-RO/images/wordpress-run-installation.png b/ro-RO/images/wordpress-run-installation.png new file mode 100644 index 0000000..b368d00 Binary files /dev/null and b/ro-RO/images/wordpress-run-installation.png differ diff --git a/ro-RO/images/wordpress-welcome.png b/ro-RO/images/wordpress-welcome.png new file mode 100644 index 0000000..9394739 Binary files /dev/null and b/ro-RO/images/wordpress-welcome.png differ diff --git a/ro-RO/images/wordpress_language.png b/ro-RO/images/wordpress_language.png new file mode 100644 index 0000000..4d44ba3 Binary files /dev/null and b/ro-RO/images/wordpress_language.png differ diff --git a/ro-RO/images/wp-info.png b/ro-RO/images/wp-info.png new file mode 100644 index 0000000..032e62e Binary files /dev/null and b/ro-RO/images/wp-info.png differ diff --git a/ro-RO/meta.yml b/ro-RO/meta.yml new file mode 100644 index 0000000..e8abb6b --- /dev/null +++ b/ro-RO/meta.yml @@ -0,0 +1,42 @@ +--- +title: Build a LAMP Web Server with WordPress +hero_image: images/banner.png +description: Set up a local server for a website on your Raspberry Pi +original_url: https://raspberrypi.org/learning/lamp-web-server-with-wordpress +theme: turquoise +duration: 2 +listed: true +ingredient: false +copyedit: false +curriculum: 3, design-0, programming-3, phys-comp-0, manufacture-0, community-0 +interests: '' +technologies: raspberry-pi, html-css-javascript +site_areas: projects +hardware: raspberry-pi +software: html-css-javascript +version: 4 +last_tested: 01-01-2017 +steps: + - + title: Introducere + - + title: Set up an Apache web server + completion: + - engaged + - + title: Install PHP + - + title: Install MariaDB + - + title: Download WordPress + - + title: Set up your WordPress database + completion: + - internal + - + title: WordPress configuration + completion: + - external + - + title: Challenge + challenge: true diff --git a/ro-RO/step_1.md b/ro-RO/step_1.md new file mode 100644 index 0000000..055ee62 --- /dev/null +++ b/ro-RO/step_1.md @@ -0,0 +1,12 @@ +## Ce vei face +Learn to set up a LAMP (**L**inux, **A**pache, **M**ySQL, **P**HP) stack on your Raspberry Pi and configure it to work as a web server. + + - Install software on your Raspberry Pi + - Install and configure Apache, PHP, and MySQL to create a LAMP web server + - Download WordPress and run it as a local website on your Raspberry Pi + - Configure WordPress and make your website accessible to other devices on your local network + + +### You will need +- A Raspberry Pi computer connected to the internet +- [An up to date install of the Raspberry Pi OS](https://www.raspberrypi.org/downloads/) diff --git a/ro-RO/step_2.md b/ro-RO/step_2.md new file mode 100644 index 0000000..1cb6c47 --- /dev/null +++ b/ro-RO/step_2.md @@ -0,0 +1,110 @@ +## Set up an Apache web server + +Apache is a popular web server application you can install on the Raspberry Pi to allow it to serve web pages. + +On its own, Apache can serve HTML files over HTTP. With additional modules it can serve dynamic web pages using scripting languages such as PHP. + +### Install Apache + +--- task --- + +Open a terminal window by selecting **Accessories** > **Terminal** from the menu. + +--- /task --- + +--- task --- + +Type the following command into the terminal and press Enter to install `apache2` + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo apt install apache2 -y + +--- /code --- + +**Tip:** If you see an error, make sure you are using the latest version of Raspberry Pi OS. + +--- /task --- + + +### Test the web server + +By default, Apache puts a test HTML file in the web folder that you will be able to view from your Pi or another computer on your network. + +--- task --- + +Open Chromium by selecting **Internet** > **Chromium Web Browser** from the menu. + +--- /task --- + +--- task --- + +Type `localhost` in the address bar. + +--- /task --- + +You should see this in your browser window: + +![Apache it works](images/apache-it-works.png) + +This means you have Apache working! + +### Changing the default web page + +This default web page is just a HTML file on the file system. It is located at `/var/www/html/index.html`. + +--- task --- + +Type the following command in the terminal to change to the directory containing the HTML file: + +--- code --- +--- +language: bash +line_numbers: false +--- +cd /var/www/html + +--- /code --- + +--- /task --- + +--- task --- + +Open the `index.html` file using Thonny + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo thonny index.html + +--- /code --- + +--- /task --- + +--- task --- + +Delete the contents of the file, then type a short message and save your changes. + +--- /task --- + +--- task --- + +Go back to Chromium and refresh the browser. You will see your message appear on the web page. + +--- /task --- + +--- collapse --- +--- +title: Access the page from another device on the network +--- + +You can open your web page from any other computer on your network, using the IP address of your Raspberry Pi, e.g. `http://192.168.1.10`. + +To find out your Raspberry Pi's IP address, type `hostname -I` into the terminal window. + +--- /collapse --- diff --git a/ro-RO/step_3.md b/ro-RO/step_3.md new file mode 100644 index 0000000..4bb6e7f --- /dev/null +++ b/ro-RO/step_3.md @@ -0,0 +1,91 @@ +## Install PHP + +PHP is a **preprocessor**: it's code that runs when the server receives a request for a web page via a web browser. It works out what needs to be shown on the page, and then sends that page to the browser. + +--- task --- + +Type the following command in the terminal to install PHP: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo apt install php -y + +--- /code --- + +--- /task --- + +### Test PHP + +--- task --- + +Type this command to delete the `index.html` file from earlier: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo rm index.html + +--- /code --- + +--- /task --- + +--- task --- + +Create a new file called `index.php`: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo thonny index.php + +--- /code --- + +--- /task --- + +--- task --- + +In the Thonny code editor, type this PHP code into the file and save it. + +--- code --- +--- +language: php +line_numbers: false +--- + + +--- /code --- + +--- /task --- + +--- task --- + +Refresh your browser. You should see "hello world". This page is not dynamic, but it is still served by PHP. + +![hello world](images/apache-hello-world.png) + +--- /task --- + + +--- collapse --- +--- +title: I can only see PHP code +--- +If you see the raw PHP above instead of "hello world", use this command to reload and restart Apache: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo service apache2 restart + +--- /code --- + +--- /collapse --- diff --git a/ro-RO/step_4.md b/ro-RO/step_4.md new file mode 100644 index 0000000..cc6eae1 --- /dev/null +++ b/ro-RO/step_4.md @@ -0,0 +1,75 @@ +## Install MariaDB + +MariaDB is a popular database engine. Like PHP, it's widely used on web servers, which is why projects like WordPress use it, and why those projects are so popular. + + +--- task --- + +Type this command to install the MariaDB Server and PHP-MySQL packages: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo apt install mariadb-server php-mysql -y + +--- /code --- + +--- /task --- + +--- task --- + +Now restart Apache: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo service apache2 restart + +--- /code --- + +--- /task --- + +### Set up + +--- task --- + +Run the MySQL secure installation command in the terminal window. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo mysql_secure_installation + +--- /code --- + +--- /task --- + +--- task --- + +Go through the setup wizard using the following answers: + ++ `Enter current password for root (enter for none):` — press **Enter**. + ++ `Switch to unix_socket authentication [Y/n]` - Type in **N** and press **Enter** + ++ `Change the root password?` - Type in **Y** and press **Enter** + ++ `New password:` - Type in a password and press **Enter**, then repeat a second time. **Important:** remember this root password, as you will need it later to set up WordPress. + ++ `Remove anonymous users` - Type in **Y** + ++ `Disallow root login remotely` - Type in **Y** + ++ `Remove test database and access to it` - Type in **Y** + ++ `Reload privilege tables now` - Type in **Y** + +--- /task --- + +When complete, you will see the message `All done!` and `Thanks for using MariaDB!`. diff --git a/ro-RO/step_5.md b/ro-RO/step_5.md new file mode 100644 index 0000000..d34db90 --- /dev/null +++ b/ro-RO/step_5.md @@ -0,0 +1,109 @@ +## Download WordPress + +WordPress is a popular tool used to quickly create a website or blog with an easy to use editor for creating new content. + + +--- task --- + +In your terminal, make sure you are still in the directory `/var/www/html/` + +--- code --- +--- +language: bash +line_numbers: false +--- +cd /var/www/html/ + +--- /code --- + +--- /task --- + +--- task --- + +Delete all the files in the folder. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo rm * + +--- /code --- + +--- /task --- + +--- task --- + +Type this command to download WordPress + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo wget http://wordpress.org/latest.tar.gz + +--- /code --- + +--- /task --- + +--- task --- + +Extract the WordPress software: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo tar xzf latest.tar.gz + +--- /code --- + +--- /task --- + +--- task --- + +Move the contents of the extracted `wordpress` directory to the current directory. **Tip:** Make sure you type the whole command including the dot. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo mv wordpress/* . + +--- /code --- + +--- /task --- + +--- task --- + +Tidy up by removing the download, and the now empty `wordpress` directory. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo rm -rf wordpress latest.tar.gz + +--- /code --- + +--- /task --- + +---task --- + +Change the ownership of all these files to the Apache user: **Tip:** Make sure you type the whole command including the dot. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo chown -R www-data: . + +--- /code --- + +--- /task --- diff --git a/ro-RO/step_6.md b/ro-RO/step_6.md new file mode 100644 index 0000000..eefa5ec --- /dev/null +++ b/ro-RO/step_6.md @@ -0,0 +1,95 @@ +## Set up your WordPress Database + +--- task --- + +Run `mysql` in the terminal window: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo mysql -uroot -p + +--- /code --- + +--- /task --- + +--- task --- + +Enter the root password you created when you set up the database. + +You will see the message `Welcome to the MariaDB monitor` and then the `MariaDB [(none)]>` prompt. + +--- /task --- + +--- task --- + +At the `MariaDB [(none)]>` prompt, type: **Tip:** Don't forget to type the semicolon at the end. + +--- code --- +--- +language: sql +line_numbers: false +--- +create database wordpress; + +--- /code --- + + + +--- /task --- + +If this has been successful, you should see `Query OK, 1 row affected (0.00 sec)`. + +--- task --- + +At the MariaDB prompt, grant database privileges to the root user. Change `YOURPASSWORD` to the password you created before. + +--- code --- +--- +language: sql +line_numbers: false +--- + +GRANT ALL PRIVILEGES ON wordpress.* TO 'root'@'localhost' IDENTIFIED BY 'YOURPASSWORD'; + +--- /code --- + +--- /task --- + +--- task --- + +For the changes to take effect, you will need to flush the database privileges: + +--- code --- +--- +language: sql +line_numbers: false +--- +FLUSH PRIVILEGES; + +--- /code --- + +--- /task --- + +--- task --- + +Exit the MariaDB prompt with Ctrl + D. + +--- /task --- + +--- task --- + +Restart your Raspberry Pi by typing this command in the terminal: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo reboot + +--- /code --- + +--- /task --- diff --git a/ro-RO/step_7.md b/ro-RO/step_7.md new file mode 100644 index 0000000..be18128 --- /dev/null +++ b/ro-RO/step_7.md @@ -0,0 +1,155 @@ +## WordPress configuration + +--- task --- + +Once your Raspberry Pi has rebooted, open Chromium and type `localhost` into the address bar. + +You should see a WordPress page asking to pick your language. + +![WordPress select language](images/wordpress_language.png) + +--- /task --- + +--- task --- + +Select your language and click **Continue**. + +--- /task --- + +You will be presented with the WordPress welcome screen. + +![WordPress welcome screen](images/wordpress-welcome.png) + +--- task --- + +Click the **Let's go!** button. + +--- /task --- + +--- task --- + +Now fill out the basic site information as follows: **Tip:** Make sure you type `wordpress` in the first box as the text displayed is only a suggestion, the box is blank. + +``` +Database Name: wordpress +User Name: root +Password: +Database Host: localhost +Table Prefix: wp_ +``` + +Click **Submit** to proceed. + +--- /task --- + + +--- task --- + +Click the **Run the install** button. + +--- /task --- + +--- task --- + +Fill in the information you are asked for, then click the `Install WordPress` button. + +--- /task --- + +--- task --- + +Log in, using the account you just created. + +Now you're logged in and have your site set up, you can see the website by visiting your `http://localhost/wp-admin`. + +--- /task --- + + +### Friendly permalinks + +It's recommended that you change your permalink settings to make your URLs more friendly. + +--- task --- + +Log in to WordPress and go to the dashboard. + +--- /task --- + +--- task --- + +Go to **Setting**, then **Permalinks**. + +--- /task --- + +--- task --- + +Select the **Post name** option and click **Save Changes**. + +--- /task --- + +--- task --- + +Type the following command in a terminal to enable Apache's `rewrite` mod: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo a2enmod rewrite + +--- /code --- + +--- /task --- + +--- task --- + +Open the Apache configuration file + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo geany /etc/apache2/sites-available/000-default.conf + +--- /code --- + +--- /task --- + +--- task --- + +Add the following lines after line 1. + +--- code --- +--- +language: sql line_numbers: true line_number_start: 2 +line_highlights: 3-5 +--- + AllowOverride All + +--- /code --- + +--- /task --- + +--- task --- + +Save the file and close Geany. + +--- /task --- + +--- task --- + +In a terminal type the command to restart Apache: + + + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo service apache2 restart + +--- /code --- + +--- /task --- \ No newline at end of file diff --git a/ro-RO/step_8.md b/ro-RO/step_8.md new file mode 100644 index 0000000..2e023a0 --- /dev/null +++ b/ro-RO/step_8.md @@ -0,0 +1,17 @@ +## Challenge + +--- challenge --- + +--- task --- + +Add more pages to your website. + +--- /task --- + +--- task --- + +Install a different theme from the Appearance menu. + +--- /task --- + +--- /challenge --- diff --git a/ro-RO/step_9.md b/ro-RO/step_9.md new file mode 100644 index 0000000..fc5847a --- /dev/null +++ b/ro-RO/step_9.md @@ -0,0 +1,3 @@ +## What can you do now? + +You could try setting up a [Python web server with Flask](https://projects.raspberrypi.org/en/projects/python-web-server-with-flask) \ No newline at end of file diff --git a/ru-RU/images/Python-Webserver-with-Wordpress-TILE-01.png b/ru-RU/images/Python-Webserver-with-Wordpress-TILE-01.png new file mode 100644 index 0000000..f632634 Binary files /dev/null and b/ru-RU/images/Python-Webserver-with-Wordpress-TILE-01.png differ diff --git a/ru-RU/images/Python-Webserver-with-Wordpress.png b/ru-RU/images/Python-Webserver-with-Wordpress.png new file mode 100644 index 0000000..07b0191 Binary files /dev/null and b/ru-RU/images/Python-Webserver-with-Wordpress.png differ diff --git a/ru-RU/images/apache-hello-world.png b/ru-RU/images/apache-hello-world.png new file mode 100644 index 0000000..69fb339 Binary files /dev/null and b/ru-RU/images/apache-hello-world.png differ diff --git a/ru-RU/images/apache-it-works.png b/ru-RU/images/apache-it-works.png new file mode 100644 index 0000000..fb71d9f Binary files /dev/null and b/ru-RU/images/apache-it-works.png differ diff --git a/ru-RU/images/banner.png b/ru-RU/images/banner.png new file mode 100644 index 0000000..88a7bfb Binary files /dev/null and b/ru-RU/images/banner.png differ diff --git a/ru-RU/images/create-database.png b/ru-RU/images/create-database.png new file mode 100644 index 0000000..34c91f2 Binary files /dev/null and b/ru-RU/images/create-database.png differ diff --git a/ru-RU/images/hostname.png b/ru-RU/images/hostname.png new file mode 100644 index 0000000..bb50249 Binary files /dev/null and b/ru-RU/images/hostname.png differ diff --git a/ru-RU/images/hostname_annotated.png b/ru-RU/images/hostname_annotated.png new file mode 100644 index 0000000..27b2f08 Binary files /dev/null and b/ru-RU/images/hostname_annotated.png differ diff --git a/ru-RU/images/install_apache.png b/ru-RU/images/install_apache.png new file mode 100644 index 0000000..8b5dab8 Binary files /dev/null and b/ru-RU/images/install_apache.png differ diff --git a/ru-RU/images/wordpress-database-setup.png b/ru-RU/images/wordpress-database-setup.png new file mode 100644 index 0000000..a1b2a91 Binary files /dev/null and b/ru-RU/images/wordpress-database-setup.png differ diff --git a/ru-RU/images/wordpress-information_needed.png b/ru-RU/images/wordpress-information_needed.png new file mode 100644 index 0000000..8119d0a Binary files /dev/null and b/ru-RU/images/wordpress-information_needed.png differ diff --git a/ru-RU/images/wordpress-run-installation.png b/ru-RU/images/wordpress-run-installation.png new file mode 100644 index 0000000..b368d00 Binary files /dev/null and b/ru-RU/images/wordpress-run-installation.png differ diff --git a/ru-RU/images/wordpress-welcome.png b/ru-RU/images/wordpress-welcome.png new file mode 100644 index 0000000..9394739 Binary files /dev/null and b/ru-RU/images/wordpress-welcome.png differ diff --git a/ru-RU/images/wordpress_language.png b/ru-RU/images/wordpress_language.png new file mode 100644 index 0000000..4d44ba3 Binary files /dev/null and b/ru-RU/images/wordpress_language.png differ diff --git a/ru-RU/images/wp-info.png b/ru-RU/images/wp-info.png new file mode 100644 index 0000000..032e62e Binary files /dev/null and b/ru-RU/images/wp-info.png differ diff --git a/ru-RU/meta.yml b/ru-RU/meta.yml new file mode 100644 index 0000000..155b238 --- /dev/null +++ b/ru-RU/meta.yml @@ -0,0 +1,42 @@ +--- +title: Build a LAMP Web Server with WordPress +hero_image: images/banner.png +description: Set up a local server for a website on your Raspberry Pi +original_url: https://raspberrypi.org/learning/lamp-web-server-with-wordpress +theme: turquoise +duration: 2 +listed: true +ingredient: false +copyedit: false +curriculum: 3, design-0, programming-3, phys-comp-0, production-0, community-0 +interests: '' +technologies: raspberry-pi, html-css-javascript +site_areas: projects +hardware: raspberry-pi +software: html-css-javascript +version: 4 +last_tested: 2017-01-01 +steps: + - + title: Введение + - + title: Set up an Apache web server + completion: + - engaged + - + title: Install PHP + - + title: Install MariaDB + - + title: Download WordPress + - + title: Set up your WordPress database + completion: + - internal + - + title: WordPress configuration + completion: + - external + - + title: Challenge + challenge: true diff --git a/ru-RU/step_1.md b/ru-RU/step_1.md new file mode 100644 index 0000000..7ab0b2a --- /dev/null +++ b/ru-RU/step_1.md @@ -0,0 +1,12 @@ +## Что ты сделаешь +Learn to set up a LAMP (**L**inux, **A**pache, **M**ySQL, **P**HP) stack on your Raspberry Pi and configure it to work as a web server. + + - Install software on your Raspberry Pi + - Install and configure Apache, PHP, and MySQL to create a LAMP web server + - Download WordPress and run it as a local website on your Raspberry Pi + - Configure WordPress and make your website accessible to other devices on your local network + + +### You will need +- A Raspberry Pi computer connected to the internet +- [An up to date install of the Raspberry Pi OS](https://www.raspberrypi.org/downloads/) diff --git a/ru-RU/step_2.md b/ru-RU/step_2.md new file mode 100644 index 0000000..1cb6c47 --- /dev/null +++ b/ru-RU/step_2.md @@ -0,0 +1,110 @@ +## Set up an Apache web server + +Apache is a popular web server application you can install on the Raspberry Pi to allow it to serve web pages. + +On its own, Apache can serve HTML files over HTTP. With additional modules it can serve dynamic web pages using scripting languages such as PHP. + +### Install Apache + +--- task --- + +Open a terminal window by selecting **Accessories** > **Terminal** from the menu. + +--- /task --- + +--- task --- + +Type the following command into the terminal and press Enter to install `apache2` + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo apt install apache2 -y + +--- /code --- + +**Tip:** If you see an error, make sure you are using the latest version of Raspberry Pi OS. + +--- /task --- + + +### Test the web server + +By default, Apache puts a test HTML file in the web folder that you will be able to view from your Pi or another computer on your network. + +--- task --- + +Open Chromium by selecting **Internet** > **Chromium Web Browser** from the menu. + +--- /task --- + +--- task --- + +Type `localhost` in the address bar. + +--- /task --- + +You should see this in your browser window: + +![Apache it works](images/apache-it-works.png) + +This means you have Apache working! + +### Changing the default web page + +This default web page is just a HTML file on the file system. It is located at `/var/www/html/index.html`. + +--- task --- + +Type the following command in the terminal to change to the directory containing the HTML file: + +--- code --- +--- +language: bash +line_numbers: false +--- +cd /var/www/html + +--- /code --- + +--- /task --- + +--- task --- + +Open the `index.html` file using Thonny + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo thonny index.html + +--- /code --- + +--- /task --- + +--- task --- + +Delete the contents of the file, then type a short message and save your changes. + +--- /task --- + +--- task --- + +Go back to Chromium and refresh the browser. You will see your message appear on the web page. + +--- /task --- + +--- collapse --- +--- +title: Access the page from another device on the network +--- + +You can open your web page from any other computer on your network, using the IP address of your Raspberry Pi, e.g. `http://192.168.1.10`. + +To find out your Raspberry Pi's IP address, type `hostname -I` into the terminal window. + +--- /collapse --- diff --git a/ru-RU/step_3.md b/ru-RU/step_3.md new file mode 100644 index 0000000..4bb6e7f --- /dev/null +++ b/ru-RU/step_3.md @@ -0,0 +1,91 @@ +## Install PHP + +PHP is a **preprocessor**: it's code that runs when the server receives a request for a web page via a web browser. It works out what needs to be shown on the page, and then sends that page to the browser. + +--- task --- + +Type the following command in the terminal to install PHP: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo apt install php -y + +--- /code --- + +--- /task --- + +### Test PHP + +--- task --- + +Type this command to delete the `index.html` file from earlier: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo rm index.html + +--- /code --- + +--- /task --- + +--- task --- + +Create a new file called `index.php`: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo thonny index.php + +--- /code --- + +--- /task --- + +--- task --- + +In the Thonny code editor, type this PHP code into the file and save it. + +--- code --- +--- +language: php +line_numbers: false +--- + + +--- /code --- + +--- /task --- + +--- task --- + +Refresh your browser. You should see "hello world". This page is not dynamic, but it is still served by PHP. + +![hello world](images/apache-hello-world.png) + +--- /task --- + + +--- collapse --- +--- +title: I can only see PHP code +--- +If you see the raw PHP above instead of "hello world", use this command to reload and restart Apache: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo service apache2 restart + +--- /code --- + +--- /collapse --- diff --git a/ru-RU/step_4.md b/ru-RU/step_4.md new file mode 100644 index 0000000..cc6eae1 --- /dev/null +++ b/ru-RU/step_4.md @@ -0,0 +1,75 @@ +## Install MariaDB + +MariaDB is a popular database engine. Like PHP, it's widely used on web servers, which is why projects like WordPress use it, and why those projects are so popular. + + +--- task --- + +Type this command to install the MariaDB Server and PHP-MySQL packages: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo apt install mariadb-server php-mysql -y + +--- /code --- + +--- /task --- + +--- task --- + +Now restart Apache: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo service apache2 restart + +--- /code --- + +--- /task --- + +### Set up + +--- task --- + +Run the MySQL secure installation command in the terminal window. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo mysql_secure_installation + +--- /code --- + +--- /task --- + +--- task --- + +Go through the setup wizard using the following answers: + ++ `Enter current password for root (enter for none):` — press **Enter**. + ++ `Switch to unix_socket authentication [Y/n]` - Type in **N** and press **Enter** + ++ `Change the root password?` - Type in **Y** and press **Enter** + ++ `New password:` - Type in a password and press **Enter**, then repeat a second time. **Important:** remember this root password, as you will need it later to set up WordPress. + ++ `Remove anonymous users` - Type in **Y** + ++ `Disallow root login remotely` - Type in **Y** + ++ `Remove test database and access to it` - Type in **Y** + ++ `Reload privilege tables now` - Type in **Y** + +--- /task --- + +When complete, you will see the message `All done!` and `Thanks for using MariaDB!`. diff --git a/ru-RU/step_5.md b/ru-RU/step_5.md new file mode 100644 index 0000000..d34db90 --- /dev/null +++ b/ru-RU/step_5.md @@ -0,0 +1,109 @@ +## Download WordPress + +WordPress is a popular tool used to quickly create a website or blog with an easy to use editor for creating new content. + + +--- task --- + +In your terminal, make sure you are still in the directory `/var/www/html/` + +--- code --- +--- +language: bash +line_numbers: false +--- +cd /var/www/html/ + +--- /code --- + +--- /task --- + +--- task --- + +Delete all the files in the folder. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo rm * + +--- /code --- + +--- /task --- + +--- task --- + +Type this command to download WordPress + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo wget http://wordpress.org/latest.tar.gz + +--- /code --- + +--- /task --- + +--- task --- + +Extract the WordPress software: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo tar xzf latest.tar.gz + +--- /code --- + +--- /task --- + +--- task --- + +Move the contents of the extracted `wordpress` directory to the current directory. **Tip:** Make sure you type the whole command including the dot. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo mv wordpress/* . + +--- /code --- + +--- /task --- + +--- task --- + +Tidy up by removing the download, and the now empty `wordpress` directory. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo rm -rf wordpress latest.tar.gz + +--- /code --- + +--- /task --- + +---task --- + +Change the ownership of all these files to the Apache user: **Tip:** Make sure you type the whole command including the dot. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo chown -R www-data: . + +--- /code --- + +--- /task --- diff --git a/ru-RU/step_6.md b/ru-RU/step_6.md new file mode 100644 index 0000000..eefa5ec --- /dev/null +++ b/ru-RU/step_6.md @@ -0,0 +1,95 @@ +## Set up your WordPress Database + +--- task --- + +Run `mysql` in the terminal window: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo mysql -uroot -p + +--- /code --- + +--- /task --- + +--- task --- + +Enter the root password you created when you set up the database. + +You will see the message `Welcome to the MariaDB monitor` and then the `MariaDB [(none)]>` prompt. + +--- /task --- + +--- task --- + +At the `MariaDB [(none)]>` prompt, type: **Tip:** Don't forget to type the semicolon at the end. + +--- code --- +--- +language: sql +line_numbers: false +--- +create database wordpress; + +--- /code --- + + + +--- /task --- + +If this has been successful, you should see `Query OK, 1 row affected (0.00 sec)`. + +--- task --- + +At the MariaDB prompt, grant database privileges to the root user. Change `YOURPASSWORD` to the password you created before. + +--- code --- +--- +language: sql +line_numbers: false +--- + +GRANT ALL PRIVILEGES ON wordpress.* TO 'root'@'localhost' IDENTIFIED BY 'YOURPASSWORD'; + +--- /code --- + +--- /task --- + +--- task --- + +For the changes to take effect, you will need to flush the database privileges: + +--- code --- +--- +language: sql +line_numbers: false +--- +FLUSH PRIVILEGES; + +--- /code --- + +--- /task --- + +--- task --- + +Exit the MariaDB prompt with Ctrl + D. + +--- /task --- + +--- task --- + +Restart your Raspberry Pi by typing this command in the terminal: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo reboot + +--- /code --- + +--- /task --- diff --git a/ru-RU/step_7.md b/ru-RU/step_7.md new file mode 100644 index 0000000..be18128 --- /dev/null +++ b/ru-RU/step_7.md @@ -0,0 +1,155 @@ +## WordPress configuration + +--- task --- + +Once your Raspberry Pi has rebooted, open Chromium and type `localhost` into the address bar. + +You should see a WordPress page asking to pick your language. + +![WordPress select language](images/wordpress_language.png) + +--- /task --- + +--- task --- + +Select your language and click **Continue**. + +--- /task --- + +You will be presented with the WordPress welcome screen. + +![WordPress welcome screen](images/wordpress-welcome.png) + +--- task --- + +Click the **Let's go!** button. + +--- /task --- + +--- task --- + +Now fill out the basic site information as follows: **Tip:** Make sure you type `wordpress` in the first box as the text displayed is only a suggestion, the box is blank. + +``` +Database Name: wordpress +User Name: root +Password: +Database Host: localhost +Table Prefix: wp_ +``` + +Click **Submit** to proceed. + +--- /task --- + + +--- task --- + +Click the **Run the install** button. + +--- /task --- + +--- task --- + +Fill in the information you are asked for, then click the `Install WordPress` button. + +--- /task --- + +--- task --- + +Log in, using the account you just created. + +Now you're logged in and have your site set up, you can see the website by visiting your `http://localhost/wp-admin`. + +--- /task --- + + +### Friendly permalinks + +It's recommended that you change your permalink settings to make your URLs more friendly. + +--- task --- + +Log in to WordPress and go to the dashboard. + +--- /task --- + +--- task --- + +Go to **Setting**, then **Permalinks**. + +--- /task --- + +--- task --- + +Select the **Post name** option and click **Save Changes**. + +--- /task --- + +--- task --- + +Type the following command in a terminal to enable Apache's `rewrite` mod: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo a2enmod rewrite + +--- /code --- + +--- /task --- + +--- task --- + +Open the Apache configuration file + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo geany /etc/apache2/sites-available/000-default.conf + +--- /code --- + +--- /task --- + +--- task --- + +Add the following lines after line 1. + +--- code --- +--- +language: sql line_numbers: true line_number_start: 2 +line_highlights: 3-5 +--- + AllowOverride All + +--- /code --- + +--- /task --- + +--- task --- + +Save the file and close Geany. + +--- /task --- + +--- task --- + +In a terminal type the command to restart Apache: + + + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo service apache2 restart + +--- /code --- + +--- /task --- \ No newline at end of file diff --git a/ru-RU/step_8.md b/ru-RU/step_8.md new file mode 100644 index 0000000..2e023a0 --- /dev/null +++ b/ru-RU/step_8.md @@ -0,0 +1,17 @@ +## Challenge + +--- challenge --- + +--- task --- + +Add more pages to your website. + +--- /task --- + +--- task --- + +Install a different theme from the Appearance menu. + +--- /task --- + +--- /challenge --- diff --git a/ru-RU/step_9.md b/ru-RU/step_9.md new file mode 100644 index 0000000..fc5847a --- /dev/null +++ b/ru-RU/step_9.md @@ -0,0 +1,3 @@ +## What can you do now? + +You could try setting up a [Python web server with Flask](https://projects.raspberrypi.org/en/projects/python-web-server-with-flask) \ No newline at end of file diff --git a/sl-SI/images/Python-Webserver-with-Wordpress-TILE-01.png b/sl-SI/images/Python-Webserver-with-Wordpress-TILE-01.png new file mode 100644 index 0000000..f632634 Binary files /dev/null and b/sl-SI/images/Python-Webserver-with-Wordpress-TILE-01.png differ diff --git a/sl-SI/images/Python-Webserver-with-Wordpress.png b/sl-SI/images/Python-Webserver-with-Wordpress.png new file mode 100644 index 0000000..07b0191 Binary files /dev/null and b/sl-SI/images/Python-Webserver-with-Wordpress.png differ diff --git a/sl-SI/images/apache-hello-world.png b/sl-SI/images/apache-hello-world.png new file mode 100644 index 0000000..69fb339 Binary files /dev/null and b/sl-SI/images/apache-hello-world.png differ diff --git a/sl-SI/images/apache-it-works.png b/sl-SI/images/apache-it-works.png new file mode 100644 index 0000000..fb71d9f Binary files /dev/null and b/sl-SI/images/apache-it-works.png differ diff --git a/sl-SI/images/banner.png b/sl-SI/images/banner.png new file mode 100644 index 0000000..88a7bfb Binary files /dev/null and b/sl-SI/images/banner.png differ diff --git a/sl-SI/images/create-database.png b/sl-SI/images/create-database.png new file mode 100644 index 0000000..34c91f2 Binary files /dev/null and b/sl-SI/images/create-database.png differ diff --git a/sl-SI/images/hostname.png b/sl-SI/images/hostname.png new file mode 100644 index 0000000..bb50249 Binary files /dev/null and b/sl-SI/images/hostname.png differ diff --git a/sl-SI/images/hostname_annotated.png b/sl-SI/images/hostname_annotated.png new file mode 100644 index 0000000..27b2f08 Binary files /dev/null and b/sl-SI/images/hostname_annotated.png differ diff --git a/sl-SI/images/install_apache.png b/sl-SI/images/install_apache.png new file mode 100644 index 0000000..8b5dab8 Binary files /dev/null and b/sl-SI/images/install_apache.png differ diff --git a/sl-SI/images/wordpress-database-setup.png b/sl-SI/images/wordpress-database-setup.png new file mode 100644 index 0000000..a1b2a91 Binary files /dev/null and b/sl-SI/images/wordpress-database-setup.png differ diff --git a/sl-SI/images/wordpress-information_needed.png b/sl-SI/images/wordpress-information_needed.png new file mode 100644 index 0000000..8119d0a Binary files /dev/null and b/sl-SI/images/wordpress-information_needed.png differ diff --git a/sl-SI/images/wordpress-run-installation.png b/sl-SI/images/wordpress-run-installation.png new file mode 100644 index 0000000..b368d00 Binary files /dev/null and b/sl-SI/images/wordpress-run-installation.png differ diff --git a/sl-SI/images/wordpress-welcome.png b/sl-SI/images/wordpress-welcome.png new file mode 100644 index 0000000..9394739 Binary files /dev/null and b/sl-SI/images/wordpress-welcome.png differ diff --git a/sl-SI/images/wordpress_language.png b/sl-SI/images/wordpress_language.png new file mode 100644 index 0000000..4d44ba3 Binary files /dev/null and b/sl-SI/images/wordpress_language.png differ diff --git a/sl-SI/images/wp-info.png b/sl-SI/images/wp-info.png new file mode 100644 index 0000000..032e62e Binary files /dev/null and b/sl-SI/images/wp-info.png differ diff --git a/sl-SI/meta.yml b/sl-SI/meta.yml new file mode 100644 index 0000000..a300630 --- /dev/null +++ b/sl-SI/meta.yml @@ -0,0 +1,42 @@ +--- +title: Build a LAMP Web Server with WordPress +hero_image: images/banner.png +description: Set up a local server for a website on your Raspberry Pi +original_url: https://raspberrypi.org/learning/lamp-web-server-with-wordpress +theme: turquoise +duration: 2 +listed: true +ingredient: false +copyedit: false +curriculum: 3, design-0, programming-3, phys-comp-0, manufacture-0, community-0 +interests: '' +technologies: raspberry-pi, html-css-javascript +site_areas: projects +hardware: raspberry-pi +software: html-css-javascript +version: 4 +last_tested: 2017-01-01 +steps: + - + title: Uvod + - + title: Set up an Apache web server + completion: + - engaged + - + title: Install PHP + - + title: Install MariaDB + - + title: Download WordPress + - + title: Set up your WordPress database + completion: + - internal + - + title: WordPress configuration + completion: + - external + - + title: Challenge + challenge: true diff --git a/sl-SI/step_1.md b/sl-SI/step_1.md new file mode 100644 index 0000000..76f300c --- /dev/null +++ b/sl-SI/step_1.md @@ -0,0 +1,12 @@ +## Kaj boš ustvaril-a? +Learn to set up a LAMP (**L**inux, **A**pache, **M**ySQL, **P**HP) stack on your Raspberry Pi and configure it to work as a web server. + + - Install software on your Raspberry Pi + - Install and configure Apache, PHP, and MySQL to create a LAMP web server + - Download WordPress and run it as a local website on your Raspberry Pi + - Configure WordPress and make your website accessible to other devices on your local network + + +### You will need +- A Raspberry Pi computer connected to the internet +- [An up to date install of the Raspberry Pi OS](https://www.raspberrypi.org/downloads/) diff --git a/sl-SI/step_2.md b/sl-SI/step_2.md new file mode 100644 index 0000000..1cb6c47 --- /dev/null +++ b/sl-SI/step_2.md @@ -0,0 +1,110 @@ +## Set up an Apache web server + +Apache is a popular web server application you can install on the Raspberry Pi to allow it to serve web pages. + +On its own, Apache can serve HTML files over HTTP. With additional modules it can serve dynamic web pages using scripting languages such as PHP. + +### Install Apache + +--- task --- + +Open a terminal window by selecting **Accessories** > **Terminal** from the menu. + +--- /task --- + +--- task --- + +Type the following command into the terminal and press Enter to install `apache2` + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo apt install apache2 -y + +--- /code --- + +**Tip:** If you see an error, make sure you are using the latest version of Raspberry Pi OS. + +--- /task --- + + +### Test the web server + +By default, Apache puts a test HTML file in the web folder that you will be able to view from your Pi or another computer on your network. + +--- task --- + +Open Chromium by selecting **Internet** > **Chromium Web Browser** from the menu. + +--- /task --- + +--- task --- + +Type `localhost` in the address bar. + +--- /task --- + +You should see this in your browser window: + +![Apache it works](images/apache-it-works.png) + +This means you have Apache working! + +### Changing the default web page + +This default web page is just a HTML file on the file system. It is located at `/var/www/html/index.html`. + +--- task --- + +Type the following command in the terminal to change to the directory containing the HTML file: + +--- code --- +--- +language: bash +line_numbers: false +--- +cd /var/www/html + +--- /code --- + +--- /task --- + +--- task --- + +Open the `index.html` file using Thonny + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo thonny index.html + +--- /code --- + +--- /task --- + +--- task --- + +Delete the contents of the file, then type a short message and save your changes. + +--- /task --- + +--- task --- + +Go back to Chromium and refresh the browser. You will see your message appear on the web page. + +--- /task --- + +--- collapse --- +--- +title: Access the page from another device on the network +--- + +You can open your web page from any other computer on your network, using the IP address of your Raspberry Pi, e.g. `http://192.168.1.10`. + +To find out your Raspberry Pi's IP address, type `hostname -I` into the terminal window. + +--- /collapse --- diff --git a/sl-SI/step_3.md b/sl-SI/step_3.md new file mode 100644 index 0000000..4bb6e7f --- /dev/null +++ b/sl-SI/step_3.md @@ -0,0 +1,91 @@ +## Install PHP + +PHP is a **preprocessor**: it's code that runs when the server receives a request for a web page via a web browser. It works out what needs to be shown on the page, and then sends that page to the browser. + +--- task --- + +Type the following command in the terminal to install PHP: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo apt install php -y + +--- /code --- + +--- /task --- + +### Test PHP + +--- task --- + +Type this command to delete the `index.html` file from earlier: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo rm index.html + +--- /code --- + +--- /task --- + +--- task --- + +Create a new file called `index.php`: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo thonny index.php + +--- /code --- + +--- /task --- + +--- task --- + +In the Thonny code editor, type this PHP code into the file and save it. + +--- code --- +--- +language: php +line_numbers: false +--- + + +--- /code --- + +--- /task --- + +--- task --- + +Refresh your browser. You should see "hello world". This page is not dynamic, but it is still served by PHP. + +![hello world](images/apache-hello-world.png) + +--- /task --- + + +--- collapse --- +--- +title: I can only see PHP code +--- +If you see the raw PHP above instead of "hello world", use this command to reload and restart Apache: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo service apache2 restart + +--- /code --- + +--- /collapse --- diff --git a/sl-SI/step_4.md b/sl-SI/step_4.md new file mode 100644 index 0000000..cc6eae1 --- /dev/null +++ b/sl-SI/step_4.md @@ -0,0 +1,75 @@ +## Install MariaDB + +MariaDB is a popular database engine. Like PHP, it's widely used on web servers, which is why projects like WordPress use it, and why those projects are so popular. + + +--- task --- + +Type this command to install the MariaDB Server and PHP-MySQL packages: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo apt install mariadb-server php-mysql -y + +--- /code --- + +--- /task --- + +--- task --- + +Now restart Apache: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo service apache2 restart + +--- /code --- + +--- /task --- + +### Set up + +--- task --- + +Run the MySQL secure installation command in the terminal window. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo mysql_secure_installation + +--- /code --- + +--- /task --- + +--- task --- + +Go through the setup wizard using the following answers: + ++ `Enter current password for root (enter for none):` — press **Enter**. + ++ `Switch to unix_socket authentication [Y/n]` - Type in **N** and press **Enter** + ++ `Change the root password?` - Type in **Y** and press **Enter** + ++ `New password:` - Type in a password and press **Enter**, then repeat a second time. **Important:** remember this root password, as you will need it later to set up WordPress. + ++ `Remove anonymous users` - Type in **Y** + ++ `Disallow root login remotely` - Type in **Y** + ++ `Remove test database and access to it` - Type in **Y** + ++ `Reload privilege tables now` - Type in **Y** + +--- /task --- + +When complete, you will see the message `All done!` and `Thanks for using MariaDB!`. diff --git a/sl-SI/step_5.md b/sl-SI/step_5.md new file mode 100644 index 0000000..d34db90 --- /dev/null +++ b/sl-SI/step_5.md @@ -0,0 +1,109 @@ +## Download WordPress + +WordPress is a popular tool used to quickly create a website or blog with an easy to use editor for creating new content. + + +--- task --- + +In your terminal, make sure you are still in the directory `/var/www/html/` + +--- code --- +--- +language: bash +line_numbers: false +--- +cd /var/www/html/ + +--- /code --- + +--- /task --- + +--- task --- + +Delete all the files in the folder. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo rm * + +--- /code --- + +--- /task --- + +--- task --- + +Type this command to download WordPress + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo wget http://wordpress.org/latest.tar.gz + +--- /code --- + +--- /task --- + +--- task --- + +Extract the WordPress software: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo tar xzf latest.tar.gz + +--- /code --- + +--- /task --- + +--- task --- + +Move the contents of the extracted `wordpress` directory to the current directory. **Tip:** Make sure you type the whole command including the dot. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo mv wordpress/* . + +--- /code --- + +--- /task --- + +--- task --- + +Tidy up by removing the download, and the now empty `wordpress` directory. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo rm -rf wordpress latest.tar.gz + +--- /code --- + +--- /task --- + +---task --- + +Change the ownership of all these files to the Apache user: **Tip:** Make sure you type the whole command including the dot. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo chown -R www-data: . + +--- /code --- + +--- /task --- diff --git a/sl-SI/step_6.md b/sl-SI/step_6.md new file mode 100644 index 0000000..eefa5ec --- /dev/null +++ b/sl-SI/step_6.md @@ -0,0 +1,95 @@ +## Set up your WordPress Database + +--- task --- + +Run `mysql` in the terminal window: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo mysql -uroot -p + +--- /code --- + +--- /task --- + +--- task --- + +Enter the root password you created when you set up the database. + +You will see the message `Welcome to the MariaDB monitor` and then the `MariaDB [(none)]>` prompt. + +--- /task --- + +--- task --- + +At the `MariaDB [(none)]>` prompt, type: **Tip:** Don't forget to type the semicolon at the end. + +--- code --- +--- +language: sql +line_numbers: false +--- +create database wordpress; + +--- /code --- + + + +--- /task --- + +If this has been successful, you should see `Query OK, 1 row affected (0.00 sec)`. + +--- task --- + +At the MariaDB prompt, grant database privileges to the root user. Change `YOURPASSWORD` to the password you created before. + +--- code --- +--- +language: sql +line_numbers: false +--- + +GRANT ALL PRIVILEGES ON wordpress.* TO 'root'@'localhost' IDENTIFIED BY 'YOURPASSWORD'; + +--- /code --- + +--- /task --- + +--- task --- + +For the changes to take effect, you will need to flush the database privileges: + +--- code --- +--- +language: sql +line_numbers: false +--- +FLUSH PRIVILEGES; + +--- /code --- + +--- /task --- + +--- task --- + +Exit the MariaDB prompt with Ctrl + D. + +--- /task --- + +--- task --- + +Restart your Raspberry Pi by typing this command in the terminal: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo reboot + +--- /code --- + +--- /task --- diff --git a/sl-SI/step_7.md b/sl-SI/step_7.md new file mode 100644 index 0000000..be18128 --- /dev/null +++ b/sl-SI/step_7.md @@ -0,0 +1,155 @@ +## WordPress configuration + +--- task --- + +Once your Raspberry Pi has rebooted, open Chromium and type `localhost` into the address bar. + +You should see a WordPress page asking to pick your language. + +![WordPress select language](images/wordpress_language.png) + +--- /task --- + +--- task --- + +Select your language and click **Continue**. + +--- /task --- + +You will be presented with the WordPress welcome screen. + +![WordPress welcome screen](images/wordpress-welcome.png) + +--- task --- + +Click the **Let's go!** button. + +--- /task --- + +--- task --- + +Now fill out the basic site information as follows: **Tip:** Make sure you type `wordpress` in the first box as the text displayed is only a suggestion, the box is blank. + +``` +Database Name: wordpress +User Name: root +Password: +Database Host: localhost +Table Prefix: wp_ +``` + +Click **Submit** to proceed. + +--- /task --- + + +--- task --- + +Click the **Run the install** button. + +--- /task --- + +--- task --- + +Fill in the information you are asked for, then click the `Install WordPress` button. + +--- /task --- + +--- task --- + +Log in, using the account you just created. + +Now you're logged in and have your site set up, you can see the website by visiting your `http://localhost/wp-admin`. + +--- /task --- + + +### Friendly permalinks + +It's recommended that you change your permalink settings to make your URLs more friendly. + +--- task --- + +Log in to WordPress and go to the dashboard. + +--- /task --- + +--- task --- + +Go to **Setting**, then **Permalinks**. + +--- /task --- + +--- task --- + +Select the **Post name** option and click **Save Changes**. + +--- /task --- + +--- task --- + +Type the following command in a terminal to enable Apache's `rewrite` mod: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo a2enmod rewrite + +--- /code --- + +--- /task --- + +--- task --- + +Open the Apache configuration file + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo geany /etc/apache2/sites-available/000-default.conf + +--- /code --- + +--- /task --- + +--- task --- + +Add the following lines after line 1. + +--- code --- +--- +language: sql line_numbers: true line_number_start: 2 +line_highlights: 3-5 +--- + AllowOverride All + +--- /code --- + +--- /task --- + +--- task --- + +Save the file and close Geany. + +--- /task --- + +--- task --- + +In a terminal type the command to restart Apache: + + + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo service apache2 restart + +--- /code --- + +--- /task --- \ No newline at end of file diff --git a/sl-SI/step_8.md b/sl-SI/step_8.md new file mode 100644 index 0000000..2e023a0 --- /dev/null +++ b/sl-SI/step_8.md @@ -0,0 +1,17 @@ +## Challenge + +--- challenge --- + +--- task --- + +Add more pages to your website. + +--- /task --- + +--- task --- + +Install a different theme from the Appearance menu. + +--- /task --- + +--- /challenge --- diff --git a/sl-SI/step_9.md b/sl-SI/step_9.md new file mode 100644 index 0000000..fc5847a --- /dev/null +++ b/sl-SI/step_9.md @@ -0,0 +1,3 @@ +## What can you do now? + +You could try setting up a [Python web server with Flask](https://projects.raspberrypi.org/en/projects/python-web-server-with-flask) \ No newline at end of file diff --git a/sr-SP/images/Python-Webserver-with-Wordpress-TILE-01.png b/sr-SP/images/Python-Webserver-with-Wordpress-TILE-01.png new file mode 100644 index 0000000..f632634 Binary files /dev/null and b/sr-SP/images/Python-Webserver-with-Wordpress-TILE-01.png differ diff --git a/sr-SP/images/Python-Webserver-with-Wordpress.png b/sr-SP/images/Python-Webserver-with-Wordpress.png new file mode 100644 index 0000000..07b0191 Binary files /dev/null and b/sr-SP/images/Python-Webserver-with-Wordpress.png differ diff --git a/sr-SP/images/apache-hello-world.png b/sr-SP/images/apache-hello-world.png new file mode 100644 index 0000000..69fb339 Binary files /dev/null and b/sr-SP/images/apache-hello-world.png differ diff --git a/sr-SP/images/apache-it-works.png b/sr-SP/images/apache-it-works.png new file mode 100644 index 0000000..fb71d9f Binary files /dev/null and b/sr-SP/images/apache-it-works.png differ diff --git a/sr-SP/images/banner.png b/sr-SP/images/banner.png new file mode 100644 index 0000000..88a7bfb Binary files /dev/null and b/sr-SP/images/banner.png differ diff --git a/sr-SP/images/create-database.png b/sr-SP/images/create-database.png new file mode 100644 index 0000000..34c91f2 Binary files /dev/null and b/sr-SP/images/create-database.png differ diff --git a/sr-SP/images/hostname.png b/sr-SP/images/hostname.png new file mode 100644 index 0000000..bb50249 Binary files /dev/null and b/sr-SP/images/hostname.png differ diff --git a/sr-SP/images/hostname_annotated.png b/sr-SP/images/hostname_annotated.png new file mode 100644 index 0000000..27b2f08 Binary files /dev/null and b/sr-SP/images/hostname_annotated.png differ diff --git a/sr-SP/images/install_apache.png b/sr-SP/images/install_apache.png new file mode 100644 index 0000000..8b5dab8 Binary files /dev/null and b/sr-SP/images/install_apache.png differ diff --git a/sr-SP/images/wordpress-database-setup.png b/sr-SP/images/wordpress-database-setup.png new file mode 100644 index 0000000..a1b2a91 Binary files /dev/null and b/sr-SP/images/wordpress-database-setup.png differ diff --git a/sr-SP/images/wordpress-information_needed.png b/sr-SP/images/wordpress-information_needed.png new file mode 100644 index 0000000..8119d0a Binary files /dev/null and b/sr-SP/images/wordpress-information_needed.png differ diff --git a/sr-SP/images/wordpress-run-installation.png b/sr-SP/images/wordpress-run-installation.png new file mode 100644 index 0000000..b368d00 Binary files /dev/null and b/sr-SP/images/wordpress-run-installation.png differ diff --git a/sr-SP/images/wordpress-welcome.png b/sr-SP/images/wordpress-welcome.png new file mode 100644 index 0000000..9394739 Binary files /dev/null and b/sr-SP/images/wordpress-welcome.png differ diff --git a/sr-SP/images/wordpress_language.png b/sr-SP/images/wordpress_language.png new file mode 100644 index 0000000..4d44ba3 Binary files /dev/null and b/sr-SP/images/wordpress_language.png differ diff --git a/sr-SP/images/wp-info.png b/sr-SP/images/wp-info.png new file mode 100644 index 0000000..032e62e Binary files /dev/null and b/sr-SP/images/wp-info.png differ diff --git a/sr-SP/meta.yml b/sr-SP/meta.yml new file mode 100644 index 0000000..b258aa0 --- /dev/null +++ b/sr-SP/meta.yml @@ -0,0 +1,42 @@ +--- +title: Build a LAMP Web Server with WordPress +hero_image: images/banner.png +description: Set up a local server for a website on your Raspberry Pi +original_url: https://raspberrypi.org/learning/lamp-web-server-with-wordpress +theme: тиркиз +duration: 2 +listed: true +ingredient: false +copyedit: false +curriculum: 3, design-0, programming-3, phys-comp-0, manufacture-0, community-0 +interests: '' +technologies: raspberry-pi, html-css-javascript +site_areas: projects +hardware: raspberry-pi +software: html-css-javascript +version: 4 +last_tested: 2017-01-01 +steps: + - + title: Увод + - + title: Set up an Apache web server + completion: + - engaged + - + title: Install PHP + - + title: Install MariaDB + - + title: Download WordPress + - + title: Set up your WordPress database + completion: + - internal + - + title: WordPress configuration + completion: + - external + - + title: Challenge + challenge: true diff --git a/sr-SP/step_1.md b/sr-SP/step_1.md new file mode 100644 index 0000000..84d5d06 --- /dev/null +++ b/sr-SP/step_1.md @@ -0,0 +1,12 @@ +## Шта ћеш направити +Learn to set up a LAMP (**L**inux, **A**pache, **M**ySQL, **P**HP) stack on your Raspberry Pi and configure it to work as a web server. + + - Install software on your Raspberry Pi + - Install and configure Apache, PHP, and MySQL to create a LAMP web server + - Download WordPress and run it as a local website on your Raspberry Pi + - Configure WordPress and make your website accessible to other devices on your local network + + +### You will need +- A Raspberry Pi computer connected to the internet +- [An up to date install of the Raspberry Pi OS](https://www.raspberrypi.org/downloads/) diff --git a/sr-SP/step_2.md b/sr-SP/step_2.md new file mode 100644 index 0000000..1cb6c47 --- /dev/null +++ b/sr-SP/step_2.md @@ -0,0 +1,110 @@ +## Set up an Apache web server + +Apache is a popular web server application you can install on the Raspberry Pi to allow it to serve web pages. + +On its own, Apache can serve HTML files over HTTP. With additional modules it can serve dynamic web pages using scripting languages such as PHP. + +### Install Apache + +--- task --- + +Open a terminal window by selecting **Accessories** > **Terminal** from the menu. + +--- /task --- + +--- task --- + +Type the following command into the terminal and press Enter to install `apache2` + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo apt install apache2 -y + +--- /code --- + +**Tip:** If you see an error, make sure you are using the latest version of Raspberry Pi OS. + +--- /task --- + + +### Test the web server + +By default, Apache puts a test HTML file in the web folder that you will be able to view from your Pi or another computer on your network. + +--- task --- + +Open Chromium by selecting **Internet** > **Chromium Web Browser** from the menu. + +--- /task --- + +--- task --- + +Type `localhost` in the address bar. + +--- /task --- + +You should see this in your browser window: + +![Apache it works](images/apache-it-works.png) + +This means you have Apache working! + +### Changing the default web page + +This default web page is just a HTML file on the file system. It is located at `/var/www/html/index.html`. + +--- task --- + +Type the following command in the terminal to change to the directory containing the HTML file: + +--- code --- +--- +language: bash +line_numbers: false +--- +cd /var/www/html + +--- /code --- + +--- /task --- + +--- task --- + +Open the `index.html` file using Thonny + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo thonny index.html + +--- /code --- + +--- /task --- + +--- task --- + +Delete the contents of the file, then type a short message and save your changes. + +--- /task --- + +--- task --- + +Go back to Chromium and refresh the browser. You will see your message appear on the web page. + +--- /task --- + +--- collapse --- +--- +title: Access the page from another device on the network +--- + +You can open your web page from any other computer on your network, using the IP address of your Raspberry Pi, e.g. `http://192.168.1.10`. + +To find out your Raspberry Pi's IP address, type `hostname -I` into the terminal window. + +--- /collapse --- diff --git a/sr-SP/step_3.md b/sr-SP/step_3.md new file mode 100644 index 0000000..4bb6e7f --- /dev/null +++ b/sr-SP/step_3.md @@ -0,0 +1,91 @@ +## Install PHP + +PHP is a **preprocessor**: it's code that runs when the server receives a request for a web page via a web browser. It works out what needs to be shown on the page, and then sends that page to the browser. + +--- task --- + +Type the following command in the terminal to install PHP: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo apt install php -y + +--- /code --- + +--- /task --- + +### Test PHP + +--- task --- + +Type this command to delete the `index.html` file from earlier: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo rm index.html + +--- /code --- + +--- /task --- + +--- task --- + +Create a new file called `index.php`: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo thonny index.php + +--- /code --- + +--- /task --- + +--- task --- + +In the Thonny code editor, type this PHP code into the file and save it. + +--- code --- +--- +language: php +line_numbers: false +--- + + +--- /code --- + +--- /task --- + +--- task --- + +Refresh your browser. You should see "hello world". This page is not dynamic, but it is still served by PHP. + +![hello world](images/apache-hello-world.png) + +--- /task --- + + +--- collapse --- +--- +title: I can only see PHP code +--- +If you see the raw PHP above instead of "hello world", use this command to reload and restart Apache: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo service apache2 restart + +--- /code --- + +--- /collapse --- diff --git a/sr-SP/step_4.md b/sr-SP/step_4.md new file mode 100644 index 0000000..cc6eae1 --- /dev/null +++ b/sr-SP/step_4.md @@ -0,0 +1,75 @@ +## Install MariaDB + +MariaDB is a popular database engine. Like PHP, it's widely used on web servers, which is why projects like WordPress use it, and why those projects are so popular. + + +--- task --- + +Type this command to install the MariaDB Server and PHP-MySQL packages: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo apt install mariadb-server php-mysql -y + +--- /code --- + +--- /task --- + +--- task --- + +Now restart Apache: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo service apache2 restart + +--- /code --- + +--- /task --- + +### Set up + +--- task --- + +Run the MySQL secure installation command in the terminal window. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo mysql_secure_installation + +--- /code --- + +--- /task --- + +--- task --- + +Go through the setup wizard using the following answers: + ++ `Enter current password for root (enter for none):` — press **Enter**. + ++ `Switch to unix_socket authentication [Y/n]` - Type in **N** and press **Enter** + ++ `Change the root password?` - Type in **Y** and press **Enter** + ++ `New password:` - Type in a password and press **Enter**, then repeat a second time. **Important:** remember this root password, as you will need it later to set up WordPress. + ++ `Remove anonymous users` - Type in **Y** + ++ `Disallow root login remotely` - Type in **Y** + ++ `Remove test database and access to it` - Type in **Y** + ++ `Reload privilege tables now` - Type in **Y** + +--- /task --- + +When complete, you will see the message `All done!` and `Thanks for using MariaDB!`. diff --git a/sr-SP/step_5.md b/sr-SP/step_5.md new file mode 100644 index 0000000..d34db90 --- /dev/null +++ b/sr-SP/step_5.md @@ -0,0 +1,109 @@ +## Download WordPress + +WordPress is a popular tool used to quickly create a website or blog with an easy to use editor for creating new content. + + +--- task --- + +In your terminal, make sure you are still in the directory `/var/www/html/` + +--- code --- +--- +language: bash +line_numbers: false +--- +cd /var/www/html/ + +--- /code --- + +--- /task --- + +--- task --- + +Delete all the files in the folder. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo rm * + +--- /code --- + +--- /task --- + +--- task --- + +Type this command to download WordPress + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo wget http://wordpress.org/latest.tar.gz + +--- /code --- + +--- /task --- + +--- task --- + +Extract the WordPress software: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo tar xzf latest.tar.gz + +--- /code --- + +--- /task --- + +--- task --- + +Move the contents of the extracted `wordpress` directory to the current directory. **Tip:** Make sure you type the whole command including the dot. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo mv wordpress/* . + +--- /code --- + +--- /task --- + +--- task --- + +Tidy up by removing the download, and the now empty `wordpress` directory. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo rm -rf wordpress latest.tar.gz + +--- /code --- + +--- /task --- + +---task --- + +Change the ownership of all these files to the Apache user: **Tip:** Make sure you type the whole command including the dot. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo chown -R www-data: . + +--- /code --- + +--- /task --- diff --git a/sr-SP/step_6.md b/sr-SP/step_6.md new file mode 100644 index 0000000..eefa5ec --- /dev/null +++ b/sr-SP/step_6.md @@ -0,0 +1,95 @@ +## Set up your WordPress Database + +--- task --- + +Run `mysql` in the terminal window: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo mysql -uroot -p + +--- /code --- + +--- /task --- + +--- task --- + +Enter the root password you created when you set up the database. + +You will see the message `Welcome to the MariaDB monitor` and then the `MariaDB [(none)]>` prompt. + +--- /task --- + +--- task --- + +At the `MariaDB [(none)]>` prompt, type: **Tip:** Don't forget to type the semicolon at the end. + +--- code --- +--- +language: sql +line_numbers: false +--- +create database wordpress; + +--- /code --- + + + +--- /task --- + +If this has been successful, you should see `Query OK, 1 row affected (0.00 sec)`. + +--- task --- + +At the MariaDB prompt, grant database privileges to the root user. Change `YOURPASSWORD` to the password you created before. + +--- code --- +--- +language: sql +line_numbers: false +--- + +GRANT ALL PRIVILEGES ON wordpress.* TO 'root'@'localhost' IDENTIFIED BY 'YOURPASSWORD'; + +--- /code --- + +--- /task --- + +--- task --- + +For the changes to take effect, you will need to flush the database privileges: + +--- code --- +--- +language: sql +line_numbers: false +--- +FLUSH PRIVILEGES; + +--- /code --- + +--- /task --- + +--- task --- + +Exit the MariaDB prompt with Ctrl + D. + +--- /task --- + +--- task --- + +Restart your Raspberry Pi by typing this command in the terminal: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo reboot + +--- /code --- + +--- /task --- diff --git a/sr-SP/step_7.md b/sr-SP/step_7.md new file mode 100644 index 0000000..be18128 --- /dev/null +++ b/sr-SP/step_7.md @@ -0,0 +1,155 @@ +## WordPress configuration + +--- task --- + +Once your Raspberry Pi has rebooted, open Chromium and type `localhost` into the address bar. + +You should see a WordPress page asking to pick your language. + +![WordPress select language](images/wordpress_language.png) + +--- /task --- + +--- task --- + +Select your language and click **Continue**. + +--- /task --- + +You will be presented with the WordPress welcome screen. + +![WordPress welcome screen](images/wordpress-welcome.png) + +--- task --- + +Click the **Let's go!** button. + +--- /task --- + +--- task --- + +Now fill out the basic site information as follows: **Tip:** Make sure you type `wordpress` in the first box as the text displayed is only a suggestion, the box is blank. + +``` +Database Name: wordpress +User Name: root +Password: +Database Host: localhost +Table Prefix: wp_ +``` + +Click **Submit** to proceed. + +--- /task --- + + +--- task --- + +Click the **Run the install** button. + +--- /task --- + +--- task --- + +Fill in the information you are asked for, then click the `Install WordPress` button. + +--- /task --- + +--- task --- + +Log in, using the account you just created. + +Now you're logged in and have your site set up, you can see the website by visiting your `http://localhost/wp-admin`. + +--- /task --- + + +### Friendly permalinks + +It's recommended that you change your permalink settings to make your URLs more friendly. + +--- task --- + +Log in to WordPress and go to the dashboard. + +--- /task --- + +--- task --- + +Go to **Setting**, then **Permalinks**. + +--- /task --- + +--- task --- + +Select the **Post name** option and click **Save Changes**. + +--- /task --- + +--- task --- + +Type the following command in a terminal to enable Apache's `rewrite` mod: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo a2enmod rewrite + +--- /code --- + +--- /task --- + +--- task --- + +Open the Apache configuration file + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo geany /etc/apache2/sites-available/000-default.conf + +--- /code --- + +--- /task --- + +--- task --- + +Add the following lines after line 1. + +--- code --- +--- +language: sql line_numbers: true line_number_start: 2 +line_highlights: 3-5 +--- + AllowOverride All + +--- /code --- + +--- /task --- + +--- task --- + +Save the file and close Geany. + +--- /task --- + +--- task --- + +In a terminal type the command to restart Apache: + + + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo service apache2 restart + +--- /code --- + +--- /task --- \ No newline at end of file diff --git a/sr-SP/step_8.md b/sr-SP/step_8.md new file mode 100644 index 0000000..2e023a0 --- /dev/null +++ b/sr-SP/step_8.md @@ -0,0 +1,17 @@ +## Challenge + +--- challenge --- + +--- task --- + +Add more pages to your website. + +--- /task --- + +--- task --- + +Install a different theme from the Appearance menu. + +--- /task --- + +--- /challenge --- diff --git a/sr-SP/step_9.md b/sr-SP/step_9.md new file mode 100644 index 0000000..fc5847a --- /dev/null +++ b/sr-SP/step_9.md @@ -0,0 +1,3 @@ +## What can you do now? + +You could try setting up a [Python web server with Flask](https://projects.raspberrypi.org/en/projects/python-web-server-with-flask) \ No newline at end of file diff --git a/sv-SE/images/Python-Webserver-with-Wordpress-TILE-01.png b/sv-SE/images/Python-Webserver-with-Wordpress-TILE-01.png new file mode 100644 index 0000000..f632634 Binary files /dev/null and b/sv-SE/images/Python-Webserver-with-Wordpress-TILE-01.png differ diff --git a/sv-SE/images/Python-Webserver-with-Wordpress.png b/sv-SE/images/Python-Webserver-with-Wordpress.png new file mode 100644 index 0000000..07b0191 Binary files /dev/null and b/sv-SE/images/Python-Webserver-with-Wordpress.png differ diff --git a/sv-SE/images/apache-hello-world.png b/sv-SE/images/apache-hello-world.png new file mode 100644 index 0000000..69fb339 Binary files /dev/null and b/sv-SE/images/apache-hello-world.png differ diff --git a/sv-SE/images/apache-it-works.png b/sv-SE/images/apache-it-works.png new file mode 100644 index 0000000..fb71d9f Binary files /dev/null and b/sv-SE/images/apache-it-works.png differ diff --git a/sv-SE/images/banner.png b/sv-SE/images/banner.png new file mode 100644 index 0000000..88a7bfb Binary files /dev/null and b/sv-SE/images/banner.png differ diff --git a/sv-SE/images/create-database.png b/sv-SE/images/create-database.png new file mode 100644 index 0000000..34c91f2 Binary files /dev/null and b/sv-SE/images/create-database.png differ diff --git a/sv-SE/images/hostname.png b/sv-SE/images/hostname.png new file mode 100644 index 0000000..bb50249 Binary files /dev/null and b/sv-SE/images/hostname.png differ diff --git a/sv-SE/images/hostname_annotated.png b/sv-SE/images/hostname_annotated.png new file mode 100644 index 0000000..27b2f08 Binary files /dev/null and b/sv-SE/images/hostname_annotated.png differ diff --git a/sv-SE/images/install_apache.png b/sv-SE/images/install_apache.png new file mode 100644 index 0000000..8b5dab8 Binary files /dev/null and b/sv-SE/images/install_apache.png differ diff --git a/sv-SE/images/wordpress-database-setup.png b/sv-SE/images/wordpress-database-setup.png new file mode 100644 index 0000000..a1b2a91 Binary files /dev/null and b/sv-SE/images/wordpress-database-setup.png differ diff --git a/sv-SE/images/wordpress-information_needed.png b/sv-SE/images/wordpress-information_needed.png new file mode 100644 index 0000000..8119d0a Binary files /dev/null and b/sv-SE/images/wordpress-information_needed.png differ diff --git a/sv-SE/images/wordpress-run-installation.png b/sv-SE/images/wordpress-run-installation.png new file mode 100644 index 0000000..b368d00 Binary files /dev/null and b/sv-SE/images/wordpress-run-installation.png differ diff --git a/sv-SE/images/wordpress-welcome.png b/sv-SE/images/wordpress-welcome.png new file mode 100644 index 0000000..9394739 Binary files /dev/null and b/sv-SE/images/wordpress-welcome.png differ diff --git a/sv-SE/images/wordpress_language.png b/sv-SE/images/wordpress_language.png new file mode 100644 index 0000000..4d44ba3 Binary files /dev/null and b/sv-SE/images/wordpress_language.png differ diff --git a/sv-SE/images/wp-info.png b/sv-SE/images/wp-info.png new file mode 100644 index 0000000..032e62e Binary files /dev/null and b/sv-SE/images/wp-info.png differ diff --git a/sv-SE/meta.yml b/sv-SE/meta.yml new file mode 100644 index 0000000..7735133 --- /dev/null +++ b/sv-SE/meta.yml @@ -0,0 +1,42 @@ +--- +title: Build a LAMP Web Server with WordPress +hero_image: bilder/banderoll.png +description: Set up a local server for a website on your Raspberry Pi +original_url: https://raspberrypi.org/learning/lamp-web-server-with-wordpress +theme: turquoise +duration: 2 +listed: true +ingredient: false +copyedit: false +curriculum: 3, design-0, programming-3, phys-comp-0, manufacture-0, community-0 +interests: '' +technologies: raspberry-pi, html-css-javascript +site_areas: projekt +hardware: raspberry-pi +software: html-css-javascript +version: 4 +last_tested: 2017-01-01 +steps: + - + title: Introduktion + - + title: Set up an Apache web server + completion: + - engaged + - + title: Install PHP + - + title: Install MariaDB + - + title: Download WordPress + - + title: Set up your WordPress database + completion: + - internal + - + title: WordPress configuration + completion: + - external + - + title: Challenge + challenge: true diff --git a/sv-SE/step_1.md b/sv-SE/step_1.md new file mode 100644 index 0000000..f4e94dd --- /dev/null +++ b/sv-SE/step_1.md @@ -0,0 +1,12 @@ +## Vad du kommer att göra +Learn to set up a LAMP (**L**inux, **A**pache, **M**ySQL, **P**HP) stack on your Raspberry Pi and configure it to work as a web server. + + - Install software on your Raspberry Pi + - Install and configure Apache, PHP, and MySQL to create a LAMP web server + - Download WordPress and run it as a local website on your Raspberry Pi + - Configure WordPress and make your website accessible to other devices on your local network + + +### You will need +- A Raspberry Pi computer connected to the internet +- [An up to date install of the Raspberry Pi OS](https://www.raspberrypi.org/downloads/) diff --git a/sv-SE/step_2.md b/sv-SE/step_2.md new file mode 100644 index 0000000..1cb6c47 --- /dev/null +++ b/sv-SE/step_2.md @@ -0,0 +1,110 @@ +## Set up an Apache web server + +Apache is a popular web server application you can install on the Raspberry Pi to allow it to serve web pages. + +On its own, Apache can serve HTML files over HTTP. With additional modules it can serve dynamic web pages using scripting languages such as PHP. + +### Install Apache + +--- task --- + +Open a terminal window by selecting **Accessories** > **Terminal** from the menu. + +--- /task --- + +--- task --- + +Type the following command into the terminal and press Enter to install `apache2` + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo apt install apache2 -y + +--- /code --- + +**Tip:** If you see an error, make sure you are using the latest version of Raspberry Pi OS. + +--- /task --- + + +### Test the web server + +By default, Apache puts a test HTML file in the web folder that you will be able to view from your Pi or another computer on your network. + +--- task --- + +Open Chromium by selecting **Internet** > **Chromium Web Browser** from the menu. + +--- /task --- + +--- task --- + +Type `localhost` in the address bar. + +--- /task --- + +You should see this in your browser window: + +![Apache it works](images/apache-it-works.png) + +This means you have Apache working! + +### Changing the default web page + +This default web page is just a HTML file on the file system. It is located at `/var/www/html/index.html`. + +--- task --- + +Type the following command in the terminal to change to the directory containing the HTML file: + +--- code --- +--- +language: bash +line_numbers: false +--- +cd /var/www/html + +--- /code --- + +--- /task --- + +--- task --- + +Open the `index.html` file using Thonny + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo thonny index.html + +--- /code --- + +--- /task --- + +--- task --- + +Delete the contents of the file, then type a short message and save your changes. + +--- /task --- + +--- task --- + +Go back to Chromium and refresh the browser. You will see your message appear on the web page. + +--- /task --- + +--- collapse --- +--- +title: Access the page from another device on the network +--- + +You can open your web page from any other computer on your network, using the IP address of your Raspberry Pi, e.g. `http://192.168.1.10`. + +To find out your Raspberry Pi's IP address, type `hostname -I` into the terminal window. + +--- /collapse --- diff --git a/sv-SE/step_3.md b/sv-SE/step_3.md new file mode 100644 index 0000000..4bb6e7f --- /dev/null +++ b/sv-SE/step_3.md @@ -0,0 +1,91 @@ +## Install PHP + +PHP is a **preprocessor**: it's code that runs when the server receives a request for a web page via a web browser. It works out what needs to be shown on the page, and then sends that page to the browser. + +--- task --- + +Type the following command in the terminal to install PHP: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo apt install php -y + +--- /code --- + +--- /task --- + +### Test PHP + +--- task --- + +Type this command to delete the `index.html` file from earlier: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo rm index.html + +--- /code --- + +--- /task --- + +--- task --- + +Create a new file called `index.php`: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo thonny index.php + +--- /code --- + +--- /task --- + +--- task --- + +In the Thonny code editor, type this PHP code into the file and save it. + +--- code --- +--- +language: php +line_numbers: false +--- + + +--- /code --- + +--- /task --- + +--- task --- + +Refresh your browser. You should see "hello world". This page is not dynamic, but it is still served by PHP. + +![hello world](images/apache-hello-world.png) + +--- /task --- + + +--- collapse --- +--- +title: I can only see PHP code +--- +If you see the raw PHP above instead of "hello world", use this command to reload and restart Apache: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo service apache2 restart + +--- /code --- + +--- /collapse --- diff --git a/sv-SE/step_4.md b/sv-SE/step_4.md new file mode 100644 index 0000000..cc6eae1 --- /dev/null +++ b/sv-SE/step_4.md @@ -0,0 +1,75 @@ +## Install MariaDB + +MariaDB is a popular database engine. Like PHP, it's widely used on web servers, which is why projects like WordPress use it, and why those projects are so popular. + + +--- task --- + +Type this command to install the MariaDB Server and PHP-MySQL packages: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo apt install mariadb-server php-mysql -y + +--- /code --- + +--- /task --- + +--- task --- + +Now restart Apache: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo service apache2 restart + +--- /code --- + +--- /task --- + +### Set up + +--- task --- + +Run the MySQL secure installation command in the terminal window. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo mysql_secure_installation + +--- /code --- + +--- /task --- + +--- task --- + +Go through the setup wizard using the following answers: + ++ `Enter current password for root (enter for none):` — press **Enter**. + ++ `Switch to unix_socket authentication [Y/n]` - Type in **N** and press **Enter** + ++ `Change the root password?` - Type in **Y** and press **Enter** + ++ `New password:` - Type in a password and press **Enter**, then repeat a second time. **Important:** remember this root password, as you will need it later to set up WordPress. + ++ `Remove anonymous users` - Type in **Y** + ++ `Disallow root login remotely` - Type in **Y** + ++ `Remove test database and access to it` - Type in **Y** + ++ `Reload privilege tables now` - Type in **Y** + +--- /task --- + +When complete, you will see the message `All done!` and `Thanks for using MariaDB!`. diff --git a/sv-SE/step_5.md b/sv-SE/step_5.md new file mode 100644 index 0000000..d34db90 --- /dev/null +++ b/sv-SE/step_5.md @@ -0,0 +1,109 @@ +## Download WordPress + +WordPress is a popular tool used to quickly create a website or blog with an easy to use editor for creating new content. + + +--- task --- + +In your terminal, make sure you are still in the directory `/var/www/html/` + +--- code --- +--- +language: bash +line_numbers: false +--- +cd /var/www/html/ + +--- /code --- + +--- /task --- + +--- task --- + +Delete all the files in the folder. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo rm * + +--- /code --- + +--- /task --- + +--- task --- + +Type this command to download WordPress + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo wget http://wordpress.org/latest.tar.gz + +--- /code --- + +--- /task --- + +--- task --- + +Extract the WordPress software: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo tar xzf latest.tar.gz + +--- /code --- + +--- /task --- + +--- task --- + +Move the contents of the extracted `wordpress` directory to the current directory. **Tip:** Make sure you type the whole command including the dot. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo mv wordpress/* . + +--- /code --- + +--- /task --- + +--- task --- + +Tidy up by removing the download, and the now empty `wordpress` directory. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo rm -rf wordpress latest.tar.gz + +--- /code --- + +--- /task --- + +---task --- + +Change the ownership of all these files to the Apache user: **Tip:** Make sure you type the whole command including the dot. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo chown -R www-data: . + +--- /code --- + +--- /task --- diff --git a/sv-SE/step_6.md b/sv-SE/step_6.md new file mode 100644 index 0000000..eefa5ec --- /dev/null +++ b/sv-SE/step_6.md @@ -0,0 +1,95 @@ +## Set up your WordPress Database + +--- task --- + +Run `mysql` in the terminal window: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo mysql -uroot -p + +--- /code --- + +--- /task --- + +--- task --- + +Enter the root password you created when you set up the database. + +You will see the message `Welcome to the MariaDB monitor` and then the `MariaDB [(none)]>` prompt. + +--- /task --- + +--- task --- + +At the `MariaDB [(none)]>` prompt, type: **Tip:** Don't forget to type the semicolon at the end. + +--- code --- +--- +language: sql +line_numbers: false +--- +create database wordpress; + +--- /code --- + + + +--- /task --- + +If this has been successful, you should see `Query OK, 1 row affected (0.00 sec)`. + +--- task --- + +At the MariaDB prompt, grant database privileges to the root user. Change `YOURPASSWORD` to the password you created before. + +--- code --- +--- +language: sql +line_numbers: false +--- + +GRANT ALL PRIVILEGES ON wordpress.* TO 'root'@'localhost' IDENTIFIED BY 'YOURPASSWORD'; + +--- /code --- + +--- /task --- + +--- task --- + +For the changes to take effect, you will need to flush the database privileges: + +--- code --- +--- +language: sql +line_numbers: false +--- +FLUSH PRIVILEGES; + +--- /code --- + +--- /task --- + +--- task --- + +Exit the MariaDB prompt with Ctrl + D. + +--- /task --- + +--- task --- + +Restart your Raspberry Pi by typing this command in the terminal: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo reboot + +--- /code --- + +--- /task --- diff --git a/sv-SE/step_7.md b/sv-SE/step_7.md new file mode 100644 index 0000000..be18128 --- /dev/null +++ b/sv-SE/step_7.md @@ -0,0 +1,155 @@ +## WordPress configuration + +--- task --- + +Once your Raspberry Pi has rebooted, open Chromium and type `localhost` into the address bar. + +You should see a WordPress page asking to pick your language. + +![WordPress select language](images/wordpress_language.png) + +--- /task --- + +--- task --- + +Select your language and click **Continue**. + +--- /task --- + +You will be presented with the WordPress welcome screen. + +![WordPress welcome screen](images/wordpress-welcome.png) + +--- task --- + +Click the **Let's go!** button. + +--- /task --- + +--- task --- + +Now fill out the basic site information as follows: **Tip:** Make sure you type `wordpress` in the first box as the text displayed is only a suggestion, the box is blank. + +``` +Database Name: wordpress +User Name: root +Password: +Database Host: localhost +Table Prefix: wp_ +``` + +Click **Submit** to proceed. + +--- /task --- + + +--- task --- + +Click the **Run the install** button. + +--- /task --- + +--- task --- + +Fill in the information you are asked for, then click the `Install WordPress` button. + +--- /task --- + +--- task --- + +Log in, using the account you just created. + +Now you're logged in and have your site set up, you can see the website by visiting your `http://localhost/wp-admin`. + +--- /task --- + + +### Friendly permalinks + +It's recommended that you change your permalink settings to make your URLs more friendly. + +--- task --- + +Log in to WordPress and go to the dashboard. + +--- /task --- + +--- task --- + +Go to **Setting**, then **Permalinks**. + +--- /task --- + +--- task --- + +Select the **Post name** option and click **Save Changes**. + +--- /task --- + +--- task --- + +Type the following command in a terminal to enable Apache's `rewrite` mod: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo a2enmod rewrite + +--- /code --- + +--- /task --- + +--- task --- + +Open the Apache configuration file + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo geany /etc/apache2/sites-available/000-default.conf + +--- /code --- + +--- /task --- + +--- task --- + +Add the following lines after line 1. + +--- code --- +--- +language: sql line_numbers: true line_number_start: 2 +line_highlights: 3-5 +--- + AllowOverride All + +--- /code --- + +--- /task --- + +--- task --- + +Save the file and close Geany. + +--- /task --- + +--- task --- + +In a terminal type the command to restart Apache: + + + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo service apache2 restart + +--- /code --- + +--- /task --- \ No newline at end of file diff --git a/sv-SE/step_8.md b/sv-SE/step_8.md new file mode 100644 index 0000000..2e023a0 --- /dev/null +++ b/sv-SE/step_8.md @@ -0,0 +1,17 @@ +## Challenge + +--- challenge --- + +--- task --- + +Add more pages to your website. + +--- /task --- + +--- task --- + +Install a different theme from the Appearance menu. + +--- /task --- + +--- /challenge --- diff --git a/sv-SE/step_9.md b/sv-SE/step_9.md new file mode 100644 index 0000000..fc5847a --- /dev/null +++ b/sv-SE/step_9.md @@ -0,0 +1,3 @@ +## What can you do now? + +You could try setting up a [Python web server with Flask](https://projects.raspberrypi.org/en/projects/python-web-server-with-flask) \ No newline at end of file diff --git a/tr-TR/images/Python-Webserver-with-Wordpress-TILE-01.png b/tr-TR/images/Python-Webserver-with-Wordpress-TILE-01.png new file mode 100644 index 0000000..f632634 Binary files /dev/null and b/tr-TR/images/Python-Webserver-with-Wordpress-TILE-01.png differ diff --git a/tr-TR/images/Python-Webserver-with-Wordpress.png b/tr-TR/images/Python-Webserver-with-Wordpress.png new file mode 100644 index 0000000..07b0191 Binary files /dev/null and b/tr-TR/images/Python-Webserver-with-Wordpress.png differ diff --git a/tr-TR/images/apache-hello-world.png b/tr-TR/images/apache-hello-world.png new file mode 100644 index 0000000..69fb339 Binary files /dev/null and b/tr-TR/images/apache-hello-world.png differ diff --git a/tr-TR/images/apache-it-works.png b/tr-TR/images/apache-it-works.png new file mode 100644 index 0000000..fb71d9f Binary files /dev/null and b/tr-TR/images/apache-it-works.png differ diff --git a/tr-TR/images/banner.png b/tr-TR/images/banner.png new file mode 100644 index 0000000..88a7bfb Binary files /dev/null and b/tr-TR/images/banner.png differ diff --git a/tr-TR/images/create-database.png b/tr-TR/images/create-database.png new file mode 100644 index 0000000..34c91f2 Binary files /dev/null and b/tr-TR/images/create-database.png differ diff --git a/tr-TR/images/hostname.png b/tr-TR/images/hostname.png new file mode 100644 index 0000000..bb50249 Binary files /dev/null and b/tr-TR/images/hostname.png differ diff --git a/tr-TR/images/hostname_annotated.png b/tr-TR/images/hostname_annotated.png new file mode 100644 index 0000000..27b2f08 Binary files /dev/null and b/tr-TR/images/hostname_annotated.png differ diff --git a/tr-TR/images/install_apache.png b/tr-TR/images/install_apache.png new file mode 100644 index 0000000..8b5dab8 Binary files /dev/null and b/tr-TR/images/install_apache.png differ diff --git a/tr-TR/images/wordpress-database-setup.png b/tr-TR/images/wordpress-database-setup.png new file mode 100644 index 0000000..a1b2a91 Binary files /dev/null and b/tr-TR/images/wordpress-database-setup.png differ diff --git a/tr-TR/images/wordpress-information_needed.png b/tr-TR/images/wordpress-information_needed.png new file mode 100644 index 0000000..8119d0a Binary files /dev/null and b/tr-TR/images/wordpress-information_needed.png differ diff --git a/tr-TR/images/wordpress-run-installation.png b/tr-TR/images/wordpress-run-installation.png new file mode 100644 index 0000000..b368d00 Binary files /dev/null and b/tr-TR/images/wordpress-run-installation.png differ diff --git a/tr-TR/images/wordpress-welcome.png b/tr-TR/images/wordpress-welcome.png new file mode 100644 index 0000000..9394739 Binary files /dev/null and b/tr-TR/images/wordpress-welcome.png differ diff --git a/tr-TR/images/wordpress_language.png b/tr-TR/images/wordpress_language.png new file mode 100644 index 0000000..4d44ba3 Binary files /dev/null and b/tr-TR/images/wordpress_language.png differ diff --git a/tr-TR/images/wp-info.png b/tr-TR/images/wp-info.png new file mode 100644 index 0000000..032e62e Binary files /dev/null and b/tr-TR/images/wp-info.png differ diff --git a/tr-TR/meta.yml b/tr-TR/meta.yml new file mode 100644 index 0000000..90921b2 --- /dev/null +++ b/tr-TR/meta.yml @@ -0,0 +1,42 @@ +--- +title: Build a LAMP Web Server with WordPress +hero_image: images/banner.png +description: Set up a local server for a website on your Raspberry Pi +original_url: https://raspberrypi.org/learning/lamp-web-server-with-wordpress +theme: turkuaz +duration: 2 +listed: true +ingredient: false +copyedit: false +curriculum: 3, tasarım-0, programlama-3, fiziksel-hesaplama-0, üretim-0, topluluk-0 +interests: '' +technologies: raspberry-pi, html-css-javascript +site_areas: projeler +hardware: raspberry-pi +software: html-css-javascript +version: 4 +last_tested: 01/01/2017 +steps: + - + title: Giriş + - + title: Set up an Apache web server + completion: + - engaged + - + title: Install PHP + - + title: Install MariaDB + - + title: Download WordPress + - + title: Set up your WordPress database + completion: + - internal + - + title: WordPress configuration + completion: + - external + - + title: Challenge + challenge: true diff --git a/tr-TR/step_1.md b/tr-TR/step_1.md new file mode 100644 index 0000000..c1394f3 --- /dev/null +++ b/tr-TR/step_1.md @@ -0,0 +1,12 @@ +## Ne yapacaksınız +Learn to set up a LAMP (**L**inux, **A**pache, **M**ySQL, **P**HP) stack on your Raspberry Pi and configure it to work as a web server. + + - Install software on your Raspberry Pi + - Install and configure Apache, PHP, and MySQL to create a LAMP web server + - Download WordPress and run it as a local website on your Raspberry Pi + - Configure WordPress and make your website accessible to other devices on your local network + + +### You will need +- A Raspberry Pi computer connected to the internet +- [An up to date install of the Raspberry Pi OS](https://www.raspberrypi.org/downloads/) diff --git a/tr-TR/step_2.md b/tr-TR/step_2.md new file mode 100644 index 0000000..1cb6c47 --- /dev/null +++ b/tr-TR/step_2.md @@ -0,0 +1,110 @@ +## Set up an Apache web server + +Apache is a popular web server application you can install on the Raspberry Pi to allow it to serve web pages. + +On its own, Apache can serve HTML files over HTTP. With additional modules it can serve dynamic web pages using scripting languages such as PHP. + +### Install Apache + +--- task --- + +Open a terminal window by selecting **Accessories** > **Terminal** from the menu. + +--- /task --- + +--- task --- + +Type the following command into the terminal and press Enter to install `apache2` + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo apt install apache2 -y + +--- /code --- + +**Tip:** If you see an error, make sure you are using the latest version of Raspberry Pi OS. + +--- /task --- + + +### Test the web server + +By default, Apache puts a test HTML file in the web folder that you will be able to view from your Pi or another computer on your network. + +--- task --- + +Open Chromium by selecting **Internet** > **Chromium Web Browser** from the menu. + +--- /task --- + +--- task --- + +Type `localhost` in the address bar. + +--- /task --- + +You should see this in your browser window: + +![Apache it works](images/apache-it-works.png) + +This means you have Apache working! + +### Changing the default web page + +This default web page is just a HTML file on the file system. It is located at `/var/www/html/index.html`. + +--- task --- + +Type the following command in the terminal to change to the directory containing the HTML file: + +--- code --- +--- +language: bash +line_numbers: false +--- +cd /var/www/html + +--- /code --- + +--- /task --- + +--- task --- + +Open the `index.html` file using Thonny + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo thonny index.html + +--- /code --- + +--- /task --- + +--- task --- + +Delete the contents of the file, then type a short message and save your changes. + +--- /task --- + +--- task --- + +Go back to Chromium and refresh the browser. You will see your message appear on the web page. + +--- /task --- + +--- collapse --- +--- +title: Access the page from another device on the network +--- + +You can open your web page from any other computer on your network, using the IP address of your Raspberry Pi, e.g. `http://192.168.1.10`. + +To find out your Raspberry Pi's IP address, type `hostname -I` into the terminal window. + +--- /collapse --- diff --git a/tr-TR/step_3.md b/tr-TR/step_3.md new file mode 100644 index 0000000..4bb6e7f --- /dev/null +++ b/tr-TR/step_3.md @@ -0,0 +1,91 @@ +## Install PHP + +PHP is a **preprocessor**: it's code that runs when the server receives a request for a web page via a web browser. It works out what needs to be shown on the page, and then sends that page to the browser. + +--- task --- + +Type the following command in the terminal to install PHP: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo apt install php -y + +--- /code --- + +--- /task --- + +### Test PHP + +--- task --- + +Type this command to delete the `index.html` file from earlier: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo rm index.html + +--- /code --- + +--- /task --- + +--- task --- + +Create a new file called `index.php`: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo thonny index.php + +--- /code --- + +--- /task --- + +--- task --- + +In the Thonny code editor, type this PHP code into the file and save it. + +--- code --- +--- +language: php +line_numbers: false +--- + + +--- /code --- + +--- /task --- + +--- task --- + +Refresh your browser. You should see "hello world". This page is not dynamic, but it is still served by PHP. + +![hello world](images/apache-hello-world.png) + +--- /task --- + + +--- collapse --- +--- +title: I can only see PHP code +--- +If you see the raw PHP above instead of "hello world", use this command to reload and restart Apache: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo service apache2 restart + +--- /code --- + +--- /collapse --- diff --git a/tr-TR/step_4.md b/tr-TR/step_4.md new file mode 100644 index 0000000..cc6eae1 --- /dev/null +++ b/tr-TR/step_4.md @@ -0,0 +1,75 @@ +## Install MariaDB + +MariaDB is a popular database engine. Like PHP, it's widely used on web servers, which is why projects like WordPress use it, and why those projects are so popular. + + +--- task --- + +Type this command to install the MariaDB Server and PHP-MySQL packages: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo apt install mariadb-server php-mysql -y + +--- /code --- + +--- /task --- + +--- task --- + +Now restart Apache: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo service apache2 restart + +--- /code --- + +--- /task --- + +### Set up + +--- task --- + +Run the MySQL secure installation command in the terminal window. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo mysql_secure_installation + +--- /code --- + +--- /task --- + +--- task --- + +Go through the setup wizard using the following answers: + ++ `Enter current password for root (enter for none):` — press **Enter**. + ++ `Switch to unix_socket authentication [Y/n]` - Type in **N** and press **Enter** + ++ `Change the root password?` - Type in **Y** and press **Enter** + ++ `New password:` - Type in a password and press **Enter**, then repeat a second time. **Important:** remember this root password, as you will need it later to set up WordPress. + ++ `Remove anonymous users` - Type in **Y** + ++ `Disallow root login remotely` - Type in **Y** + ++ `Remove test database and access to it` - Type in **Y** + ++ `Reload privilege tables now` - Type in **Y** + +--- /task --- + +When complete, you will see the message `All done!` and `Thanks for using MariaDB!`. diff --git a/tr-TR/step_5.md b/tr-TR/step_5.md new file mode 100644 index 0000000..d34db90 --- /dev/null +++ b/tr-TR/step_5.md @@ -0,0 +1,109 @@ +## Download WordPress + +WordPress is a popular tool used to quickly create a website or blog with an easy to use editor for creating new content. + + +--- task --- + +In your terminal, make sure you are still in the directory `/var/www/html/` + +--- code --- +--- +language: bash +line_numbers: false +--- +cd /var/www/html/ + +--- /code --- + +--- /task --- + +--- task --- + +Delete all the files in the folder. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo rm * + +--- /code --- + +--- /task --- + +--- task --- + +Type this command to download WordPress + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo wget http://wordpress.org/latest.tar.gz + +--- /code --- + +--- /task --- + +--- task --- + +Extract the WordPress software: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo tar xzf latest.tar.gz + +--- /code --- + +--- /task --- + +--- task --- + +Move the contents of the extracted `wordpress` directory to the current directory. **Tip:** Make sure you type the whole command including the dot. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo mv wordpress/* . + +--- /code --- + +--- /task --- + +--- task --- + +Tidy up by removing the download, and the now empty `wordpress` directory. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo rm -rf wordpress latest.tar.gz + +--- /code --- + +--- /task --- + +---task --- + +Change the ownership of all these files to the Apache user: **Tip:** Make sure you type the whole command including the dot. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo chown -R www-data: . + +--- /code --- + +--- /task --- diff --git a/tr-TR/step_6.md b/tr-TR/step_6.md new file mode 100644 index 0000000..eefa5ec --- /dev/null +++ b/tr-TR/step_6.md @@ -0,0 +1,95 @@ +## Set up your WordPress Database + +--- task --- + +Run `mysql` in the terminal window: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo mysql -uroot -p + +--- /code --- + +--- /task --- + +--- task --- + +Enter the root password you created when you set up the database. + +You will see the message `Welcome to the MariaDB monitor` and then the `MariaDB [(none)]>` prompt. + +--- /task --- + +--- task --- + +At the `MariaDB [(none)]>` prompt, type: **Tip:** Don't forget to type the semicolon at the end. + +--- code --- +--- +language: sql +line_numbers: false +--- +create database wordpress; + +--- /code --- + + + +--- /task --- + +If this has been successful, you should see `Query OK, 1 row affected (0.00 sec)`. + +--- task --- + +At the MariaDB prompt, grant database privileges to the root user. Change `YOURPASSWORD` to the password you created before. + +--- code --- +--- +language: sql +line_numbers: false +--- + +GRANT ALL PRIVILEGES ON wordpress.* TO 'root'@'localhost' IDENTIFIED BY 'YOURPASSWORD'; + +--- /code --- + +--- /task --- + +--- task --- + +For the changes to take effect, you will need to flush the database privileges: + +--- code --- +--- +language: sql +line_numbers: false +--- +FLUSH PRIVILEGES; + +--- /code --- + +--- /task --- + +--- task --- + +Exit the MariaDB prompt with Ctrl + D. + +--- /task --- + +--- task --- + +Restart your Raspberry Pi by typing this command in the terminal: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo reboot + +--- /code --- + +--- /task --- diff --git a/tr-TR/step_7.md b/tr-TR/step_7.md new file mode 100644 index 0000000..be18128 --- /dev/null +++ b/tr-TR/step_7.md @@ -0,0 +1,155 @@ +## WordPress configuration + +--- task --- + +Once your Raspberry Pi has rebooted, open Chromium and type `localhost` into the address bar. + +You should see a WordPress page asking to pick your language. + +![WordPress select language](images/wordpress_language.png) + +--- /task --- + +--- task --- + +Select your language and click **Continue**. + +--- /task --- + +You will be presented with the WordPress welcome screen. + +![WordPress welcome screen](images/wordpress-welcome.png) + +--- task --- + +Click the **Let's go!** button. + +--- /task --- + +--- task --- + +Now fill out the basic site information as follows: **Tip:** Make sure you type `wordpress` in the first box as the text displayed is only a suggestion, the box is blank. + +``` +Database Name: wordpress +User Name: root +Password: +Database Host: localhost +Table Prefix: wp_ +``` + +Click **Submit** to proceed. + +--- /task --- + + +--- task --- + +Click the **Run the install** button. + +--- /task --- + +--- task --- + +Fill in the information you are asked for, then click the `Install WordPress` button. + +--- /task --- + +--- task --- + +Log in, using the account you just created. + +Now you're logged in and have your site set up, you can see the website by visiting your `http://localhost/wp-admin`. + +--- /task --- + + +### Friendly permalinks + +It's recommended that you change your permalink settings to make your URLs more friendly. + +--- task --- + +Log in to WordPress and go to the dashboard. + +--- /task --- + +--- task --- + +Go to **Setting**, then **Permalinks**. + +--- /task --- + +--- task --- + +Select the **Post name** option and click **Save Changes**. + +--- /task --- + +--- task --- + +Type the following command in a terminal to enable Apache's `rewrite` mod: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo a2enmod rewrite + +--- /code --- + +--- /task --- + +--- task --- + +Open the Apache configuration file + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo geany /etc/apache2/sites-available/000-default.conf + +--- /code --- + +--- /task --- + +--- task --- + +Add the following lines after line 1. + +--- code --- +--- +language: sql line_numbers: true line_number_start: 2 +line_highlights: 3-5 +--- + AllowOverride All + +--- /code --- + +--- /task --- + +--- task --- + +Save the file and close Geany. + +--- /task --- + +--- task --- + +In a terminal type the command to restart Apache: + + + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo service apache2 restart + +--- /code --- + +--- /task --- \ No newline at end of file diff --git a/tr-TR/step_8.md b/tr-TR/step_8.md new file mode 100644 index 0000000..2e023a0 --- /dev/null +++ b/tr-TR/step_8.md @@ -0,0 +1,17 @@ +## Challenge + +--- challenge --- + +--- task --- + +Add more pages to your website. + +--- /task --- + +--- task --- + +Install a different theme from the Appearance menu. + +--- /task --- + +--- /challenge --- diff --git a/tr-TR/step_9.md b/tr-TR/step_9.md new file mode 100644 index 0000000..fc5847a --- /dev/null +++ b/tr-TR/step_9.md @@ -0,0 +1,3 @@ +## What can you do now? + +You could try setting up a [Python web server with Flask](https://projects.raspberrypi.org/en/projects/python-web-server-with-flask) \ No newline at end of file diff --git a/uk-UA/images/Python-Webserver-with-Wordpress-TILE-01.png b/uk-UA/images/Python-Webserver-with-Wordpress-TILE-01.png new file mode 100644 index 0000000..f632634 Binary files /dev/null and b/uk-UA/images/Python-Webserver-with-Wordpress-TILE-01.png differ diff --git a/uk-UA/images/Python-Webserver-with-Wordpress.png b/uk-UA/images/Python-Webserver-with-Wordpress.png new file mode 100644 index 0000000..07b0191 Binary files /dev/null and b/uk-UA/images/Python-Webserver-with-Wordpress.png differ diff --git a/uk-UA/images/apache-hello-world.png b/uk-UA/images/apache-hello-world.png new file mode 100644 index 0000000..69fb339 Binary files /dev/null and b/uk-UA/images/apache-hello-world.png differ diff --git a/uk-UA/images/apache-it-works.png b/uk-UA/images/apache-it-works.png new file mode 100644 index 0000000..fb71d9f Binary files /dev/null and b/uk-UA/images/apache-it-works.png differ diff --git a/uk-UA/images/banner.png b/uk-UA/images/banner.png new file mode 100644 index 0000000..88a7bfb Binary files /dev/null and b/uk-UA/images/banner.png differ diff --git a/uk-UA/images/create-database.png b/uk-UA/images/create-database.png new file mode 100644 index 0000000..34c91f2 Binary files /dev/null and b/uk-UA/images/create-database.png differ diff --git a/uk-UA/images/hostname.png b/uk-UA/images/hostname.png new file mode 100644 index 0000000..bb50249 Binary files /dev/null and b/uk-UA/images/hostname.png differ diff --git a/uk-UA/images/hostname_annotated.png b/uk-UA/images/hostname_annotated.png new file mode 100644 index 0000000..27b2f08 Binary files /dev/null and b/uk-UA/images/hostname_annotated.png differ diff --git a/uk-UA/images/install_apache.png b/uk-UA/images/install_apache.png new file mode 100644 index 0000000..8b5dab8 Binary files /dev/null and b/uk-UA/images/install_apache.png differ diff --git a/uk-UA/images/wordpress-database-setup.png b/uk-UA/images/wordpress-database-setup.png new file mode 100644 index 0000000..a1b2a91 Binary files /dev/null and b/uk-UA/images/wordpress-database-setup.png differ diff --git a/uk-UA/images/wordpress-information_needed.png b/uk-UA/images/wordpress-information_needed.png new file mode 100644 index 0000000..8119d0a Binary files /dev/null and b/uk-UA/images/wordpress-information_needed.png differ diff --git a/uk-UA/images/wordpress-run-installation.png b/uk-UA/images/wordpress-run-installation.png new file mode 100644 index 0000000..b368d00 Binary files /dev/null and b/uk-UA/images/wordpress-run-installation.png differ diff --git a/uk-UA/images/wordpress-welcome.png b/uk-UA/images/wordpress-welcome.png new file mode 100644 index 0000000..9394739 Binary files /dev/null and b/uk-UA/images/wordpress-welcome.png differ diff --git a/uk-UA/images/wordpress_language.png b/uk-UA/images/wordpress_language.png new file mode 100644 index 0000000..4d44ba3 Binary files /dev/null and b/uk-UA/images/wordpress_language.png differ diff --git a/uk-UA/images/wp-info.png b/uk-UA/images/wp-info.png new file mode 100644 index 0000000..032e62e Binary files /dev/null and b/uk-UA/images/wp-info.png differ diff --git a/uk-UA/meta.yml b/uk-UA/meta.yml new file mode 100644 index 0000000..5d6a40e --- /dev/null +++ b/uk-UA/meta.yml @@ -0,0 +1,42 @@ +--- +title: Build a LAMP Web Server with WordPress +hero_image: images/banner.png +description: Set up a local server for a website on your Raspberry Pi +original_url: https://raspberrypi.org/learning/lamp-web-server-with-wordpress +theme: turquoise +duration: 2 +listed: true +ingredient: false +copyedit: false +curriculum: 3, design-0, programming-3, phys-comp-0, manufacture-0, community-0 +interests: '' +technologies: raspberry-pi, html-css-javascript +site_areas: проекти +hardware: raspberry-pi +software: html-css-javascript +version: 4 +last_tested: 2017-01-01 +steps: + - + title: Вступ + - + title: Set up an Apache web server + completion: + - engaged + - + title: Install PHP + - + title: Install MariaDB + - + title: Download WordPress + - + title: Set up your WordPress database + completion: + - internal + - + title: WordPress configuration + completion: + - external + - + title: Challenge + challenge: true diff --git a/uk-UA/step_1.md b/uk-UA/step_1.md new file mode 100644 index 0000000..fea77f9 --- /dev/null +++ b/uk-UA/step_1.md @@ -0,0 +1,12 @@ +## Що ти зробиш +Learn to set up a LAMP (**L**inux, **A**pache, **M**ySQL, **P**HP) stack on your Raspberry Pi and configure it to work as a web server. + + - Install software on your Raspberry Pi + - Install and configure Apache, PHP, and MySQL to create a LAMP web server + - Download WordPress and run it as a local website on your Raspberry Pi + - Configure WordPress and make your website accessible to other devices on your local network + + +### You will need +- A Raspberry Pi computer connected to the internet +- [An up to date install of the Raspberry Pi OS](https://www.raspberrypi.org/downloads/) diff --git a/uk-UA/step_2.md b/uk-UA/step_2.md new file mode 100644 index 0000000..1cb6c47 --- /dev/null +++ b/uk-UA/step_2.md @@ -0,0 +1,110 @@ +## Set up an Apache web server + +Apache is a popular web server application you can install on the Raspberry Pi to allow it to serve web pages. + +On its own, Apache can serve HTML files over HTTP. With additional modules it can serve dynamic web pages using scripting languages such as PHP. + +### Install Apache + +--- task --- + +Open a terminal window by selecting **Accessories** > **Terminal** from the menu. + +--- /task --- + +--- task --- + +Type the following command into the terminal and press Enter to install `apache2` + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo apt install apache2 -y + +--- /code --- + +**Tip:** If you see an error, make sure you are using the latest version of Raspberry Pi OS. + +--- /task --- + + +### Test the web server + +By default, Apache puts a test HTML file in the web folder that you will be able to view from your Pi or another computer on your network. + +--- task --- + +Open Chromium by selecting **Internet** > **Chromium Web Browser** from the menu. + +--- /task --- + +--- task --- + +Type `localhost` in the address bar. + +--- /task --- + +You should see this in your browser window: + +![Apache it works](images/apache-it-works.png) + +This means you have Apache working! + +### Changing the default web page + +This default web page is just a HTML file on the file system. It is located at `/var/www/html/index.html`. + +--- task --- + +Type the following command in the terminal to change to the directory containing the HTML file: + +--- code --- +--- +language: bash +line_numbers: false +--- +cd /var/www/html + +--- /code --- + +--- /task --- + +--- task --- + +Open the `index.html` file using Thonny + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo thonny index.html + +--- /code --- + +--- /task --- + +--- task --- + +Delete the contents of the file, then type a short message and save your changes. + +--- /task --- + +--- task --- + +Go back to Chromium and refresh the browser. You will see your message appear on the web page. + +--- /task --- + +--- collapse --- +--- +title: Access the page from another device on the network +--- + +You can open your web page from any other computer on your network, using the IP address of your Raspberry Pi, e.g. `http://192.168.1.10`. + +To find out your Raspberry Pi's IP address, type `hostname -I` into the terminal window. + +--- /collapse --- diff --git a/uk-UA/step_3.md b/uk-UA/step_3.md new file mode 100644 index 0000000..4bb6e7f --- /dev/null +++ b/uk-UA/step_3.md @@ -0,0 +1,91 @@ +## Install PHP + +PHP is a **preprocessor**: it's code that runs when the server receives a request for a web page via a web browser. It works out what needs to be shown on the page, and then sends that page to the browser. + +--- task --- + +Type the following command in the terminal to install PHP: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo apt install php -y + +--- /code --- + +--- /task --- + +### Test PHP + +--- task --- + +Type this command to delete the `index.html` file from earlier: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo rm index.html + +--- /code --- + +--- /task --- + +--- task --- + +Create a new file called `index.php`: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo thonny index.php + +--- /code --- + +--- /task --- + +--- task --- + +In the Thonny code editor, type this PHP code into the file and save it. + +--- code --- +--- +language: php +line_numbers: false +--- + + +--- /code --- + +--- /task --- + +--- task --- + +Refresh your browser. You should see "hello world". This page is not dynamic, but it is still served by PHP. + +![hello world](images/apache-hello-world.png) + +--- /task --- + + +--- collapse --- +--- +title: I can only see PHP code +--- +If you see the raw PHP above instead of "hello world", use this command to reload and restart Apache: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo service apache2 restart + +--- /code --- + +--- /collapse --- diff --git a/uk-UA/step_4.md b/uk-UA/step_4.md new file mode 100644 index 0000000..cc6eae1 --- /dev/null +++ b/uk-UA/step_4.md @@ -0,0 +1,75 @@ +## Install MariaDB + +MariaDB is a popular database engine. Like PHP, it's widely used on web servers, which is why projects like WordPress use it, and why those projects are so popular. + + +--- task --- + +Type this command to install the MariaDB Server and PHP-MySQL packages: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo apt install mariadb-server php-mysql -y + +--- /code --- + +--- /task --- + +--- task --- + +Now restart Apache: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo service apache2 restart + +--- /code --- + +--- /task --- + +### Set up + +--- task --- + +Run the MySQL secure installation command in the terminal window. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo mysql_secure_installation + +--- /code --- + +--- /task --- + +--- task --- + +Go through the setup wizard using the following answers: + ++ `Enter current password for root (enter for none):` — press **Enter**. + ++ `Switch to unix_socket authentication [Y/n]` - Type in **N** and press **Enter** + ++ `Change the root password?` - Type in **Y** and press **Enter** + ++ `New password:` - Type in a password and press **Enter**, then repeat a second time. **Important:** remember this root password, as you will need it later to set up WordPress. + ++ `Remove anonymous users` - Type in **Y** + ++ `Disallow root login remotely` - Type in **Y** + ++ `Remove test database and access to it` - Type in **Y** + ++ `Reload privilege tables now` - Type in **Y** + +--- /task --- + +When complete, you will see the message `All done!` and `Thanks for using MariaDB!`. diff --git a/uk-UA/step_5.md b/uk-UA/step_5.md new file mode 100644 index 0000000..d34db90 --- /dev/null +++ b/uk-UA/step_5.md @@ -0,0 +1,109 @@ +## Download WordPress + +WordPress is a popular tool used to quickly create a website or blog with an easy to use editor for creating new content. + + +--- task --- + +In your terminal, make sure you are still in the directory `/var/www/html/` + +--- code --- +--- +language: bash +line_numbers: false +--- +cd /var/www/html/ + +--- /code --- + +--- /task --- + +--- task --- + +Delete all the files in the folder. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo rm * + +--- /code --- + +--- /task --- + +--- task --- + +Type this command to download WordPress + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo wget http://wordpress.org/latest.tar.gz + +--- /code --- + +--- /task --- + +--- task --- + +Extract the WordPress software: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo tar xzf latest.tar.gz + +--- /code --- + +--- /task --- + +--- task --- + +Move the contents of the extracted `wordpress` directory to the current directory. **Tip:** Make sure you type the whole command including the dot. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo mv wordpress/* . + +--- /code --- + +--- /task --- + +--- task --- + +Tidy up by removing the download, and the now empty `wordpress` directory. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo rm -rf wordpress latest.tar.gz + +--- /code --- + +--- /task --- + +---task --- + +Change the ownership of all these files to the Apache user: **Tip:** Make sure you type the whole command including the dot. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo chown -R www-data: . + +--- /code --- + +--- /task --- diff --git a/uk-UA/step_6.md b/uk-UA/step_6.md new file mode 100644 index 0000000..eefa5ec --- /dev/null +++ b/uk-UA/step_6.md @@ -0,0 +1,95 @@ +## Set up your WordPress Database + +--- task --- + +Run `mysql` in the terminal window: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo mysql -uroot -p + +--- /code --- + +--- /task --- + +--- task --- + +Enter the root password you created when you set up the database. + +You will see the message `Welcome to the MariaDB monitor` and then the `MariaDB [(none)]>` prompt. + +--- /task --- + +--- task --- + +At the `MariaDB [(none)]>` prompt, type: **Tip:** Don't forget to type the semicolon at the end. + +--- code --- +--- +language: sql +line_numbers: false +--- +create database wordpress; + +--- /code --- + + + +--- /task --- + +If this has been successful, you should see `Query OK, 1 row affected (0.00 sec)`. + +--- task --- + +At the MariaDB prompt, grant database privileges to the root user. Change `YOURPASSWORD` to the password you created before. + +--- code --- +--- +language: sql +line_numbers: false +--- + +GRANT ALL PRIVILEGES ON wordpress.* TO 'root'@'localhost' IDENTIFIED BY 'YOURPASSWORD'; + +--- /code --- + +--- /task --- + +--- task --- + +For the changes to take effect, you will need to flush the database privileges: + +--- code --- +--- +language: sql +line_numbers: false +--- +FLUSH PRIVILEGES; + +--- /code --- + +--- /task --- + +--- task --- + +Exit the MariaDB prompt with Ctrl + D. + +--- /task --- + +--- task --- + +Restart your Raspberry Pi by typing this command in the terminal: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo reboot + +--- /code --- + +--- /task --- diff --git a/uk-UA/step_7.md b/uk-UA/step_7.md new file mode 100644 index 0000000..be18128 --- /dev/null +++ b/uk-UA/step_7.md @@ -0,0 +1,155 @@ +## WordPress configuration + +--- task --- + +Once your Raspberry Pi has rebooted, open Chromium and type `localhost` into the address bar. + +You should see a WordPress page asking to pick your language. + +![WordPress select language](images/wordpress_language.png) + +--- /task --- + +--- task --- + +Select your language and click **Continue**. + +--- /task --- + +You will be presented with the WordPress welcome screen. + +![WordPress welcome screen](images/wordpress-welcome.png) + +--- task --- + +Click the **Let's go!** button. + +--- /task --- + +--- task --- + +Now fill out the basic site information as follows: **Tip:** Make sure you type `wordpress` in the first box as the text displayed is only a suggestion, the box is blank. + +``` +Database Name: wordpress +User Name: root +Password: +Database Host: localhost +Table Prefix: wp_ +``` + +Click **Submit** to proceed. + +--- /task --- + + +--- task --- + +Click the **Run the install** button. + +--- /task --- + +--- task --- + +Fill in the information you are asked for, then click the `Install WordPress` button. + +--- /task --- + +--- task --- + +Log in, using the account you just created. + +Now you're logged in and have your site set up, you can see the website by visiting your `http://localhost/wp-admin`. + +--- /task --- + + +### Friendly permalinks + +It's recommended that you change your permalink settings to make your URLs more friendly. + +--- task --- + +Log in to WordPress and go to the dashboard. + +--- /task --- + +--- task --- + +Go to **Setting**, then **Permalinks**. + +--- /task --- + +--- task --- + +Select the **Post name** option and click **Save Changes**. + +--- /task --- + +--- task --- + +Type the following command in a terminal to enable Apache's `rewrite` mod: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo a2enmod rewrite + +--- /code --- + +--- /task --- + +--- task --- + +Open the Apache configuration file + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo geany /etc/apache2/sites-available/000-default.conf + +--- /code --- + +--- /task --- + +--- task --- + +Add the following lines after line 1. + +--- code --- +--- +language: sql line_numbers: true line_number_start: 2 +line_highlights: 3-5 +--- + AllowOverride All + +--- /code --- + +--- /task --- + +--- task --- + +Save the file and close Geany. + +--- /task --- + +--- task --- + +In a terminal type the command to restart Apache: + + + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo service apache2 restart + +--- /code --- + +--- /task --- \ No newline at end of file diff --git a/uk-UA/step_8.md b/uk-UA/step_8.md new file mode 100644 index 0000000..2e023a0 --- /dev/null +++ b/uk-UA/step_8.md @@ -0,0 +1,17 @@ +## Challenge + +--- challenge --- + +--- task --- + +Add more pages to your website. + +--- /task --- + +--- task --- + +Install a different theme from the Appearance menu. + +--- /task --- + +--- /challenge --- diff --git a/uk-UA/step_9.md b/uk-UA/step_9.md new file mode 100644 index 0000000..fc5847a --- /dev/null +++ b/uk-UA/step_9.md @@ -0,0 +1,3 @@ +## What can you do now? + +You could try setting up a [Python web server with Flask](https://projects.raspberrypi.org/en/projects/python-web-server-with-flask) \ No newline at end of file diff --git a/vi-VN/images/Python-Webserver-with-Wordpress-TILE-01.png b/vi-VN/images/Python-Webserver-with-Wordpress-TILE-01.png new file mode 100644 index 0000000..f632634 Binary files /dev/null and b/vi-VN/images/Python-Webserver-with-Wordpress-TILE-01.png differ diff --git a/vi-VN/images/Python-Webserver-with-Wordpress.png b/vi-VN/images/Python-Webserver-with-Wordpress.png new file mode 100644 index 0000000..07b0191 Binary files /dev/null and b/vi-VN/images/Python-Webserver-with-Wordpress.png differ diff --git a/vi-VN/images/apache-hello-world.png b/vi-VN/images/apache-hello-world.png new file mode 100644 index 0000000..69fb339 Binary files /dev/null and b/vi-VN/images/apache-hello-world.png differ diff --git a/vi-VN/images/apache-it-works.png b/vi-VN/images/apache-it-works.png new file mode 100644 index 0000000..fb71d9f Binary files /dev/null and b/vi-VN/images/apache-it-works.png differ diff --git a/vi-VN/images/banner.png b/vi-VN/images/banner.png new file mode 100644 index 0000000..88a7bfb Binary files /dev/null and b/vi-VN/images/banner.png differ diff --git a/vi-VN/images/create-database.png b/vi-VN/images/create-database.png new file mode 100644 index 0000000..34c91f2 Binary files /dev/null and b/vi-VN/images/create-database.png differ diff --git a/vi-VN/images/hostname.png b/vi-VN/images/hostname.png new file mode 100644 index 0000000..bb50249 Binary files /dev/null and b/vi-VN/images/hostname.png differ diff --git a/vi-VN/images/hostname_annotated.png b/vi-VN/images/hostname_annotated.png new file mode 100644 index 0000000..27b2f08 Binary files /dev/null and b/vi-VN/images/hostname_annotated.png differ diff --git a/vi-VN/images/install_apache.png b/vi-VN/images/install_apache.png new file mode 100644 index 0000000..8b5dab8 Binary files /dev/null and b/vi-VN/images/install_apache.png differ diff --git a/vi-VN/images/wordpress-database-setup.png b/vi-VN/images/wordpress-database-setup.png new file mode 100644 index 0000000..a1b2a91 Binary files /dev/null and b/vi-VN/images/wordpress-database-setup.png differ diff --git a/vi-VN/images/wordpress-information_needed.png b/vi-VN/images/wordpress-information_needed.png new file mode 100644 index 0000000..8119d0a Binary files /dev/null and b/vi-VN/images/wordpress-information_needed.png differ diff --git a/vi-VN/images/wordpress-run-installation.png b/vi-VN/images/wordpress-run-installation.png new file mode 100644 index 0000000..b368d00 Binary files /dev/null and b/vi-VN/images/wordpress-run-installation.png differ diff --git a/vi-VN/images/wordpress-welcome.png b/vi-VN/images/wordpress-welcome.png new file mode 100644 index 0000000..9394739 Binary files /dev/null and b/vi-VN/images/wordpress-welcome.png differ diff --git a/vi-VN/images/wordpress_language.png b/vi-VN/images/wordpress_language.png new file mode 100644 index 0000000..4d44ba3 Binary files /dev/null and b/vi-VN/images/wordpress_language.png differ diff --git a/vi-VN/images/wp-info.png b/vi-VN/images/wp-info.png new file mode 100644 index 0000000..032e62e Binary files /dev/null and b/vi-VN/images/wp-info.png differ diff --git a/vi-VN/meta.yml b/vi-VN/meta.yml new file mode 100644 index 0000000..30ecf0b --- /dev/null +++ b/vi-VN/meta.yml @@ -0,0 +1,42 @@ +--- +title: Build a LAMP Web Server with WordPress +hero_image: images/banner.png +description: Set up a local server for a website on your Raspberry Pi +original_url: https://raspberrypi.org/learning/lamp-web-server-with-wordpress +theme: màu ngọc lam +duration: 2 +listed: true +ingredient: false +copyedit: false +curriculum: 3, design-0, programming-3, phys-comp-0, manufacture-0, community-0 +interests: '' +technologies: raspberry-pi, html-css-javascript +site_areas: các dự án +hardware: raspberry-pi +software: html-css-javascript +version: 4 +last_tested: 2017-01-01 +steps: + - + title: Giới thiệu + - + title: Set up an Apache web server + completion: + - engaged + - + title: Install PHP + - + title: Install MariaDB + - + title: Download WordPress + - + title: Set up your WordPress database + completion: + - internal + - + title: WordPress configuration + completion: + - external + - + title: Challenge + challenge: true diff --git a/vi-VN/step_1.md b/vi-VN/step_1.md new file mode 100644 index 0000000..e523069 --- /dev/null +++ b/vi-VN/step_1.md @@ -0,0 +1,12 @@ +## Những gì bạn sẽ làm +Learn to set up a LAMP (**L**inux, **A**pache, **M**ySQL, **P**HP) stack on your Raspberry Pi and configure it to work as a web server. + + - Install software on your Raspberry Pi + - Install and configure Apache, PHP, and MySQL to create a LAMP web server + - Download WordPress and run it as a local website on your Raspberry Pi + - Configure WordPress and make your website accessible to other devices on your local network + + +### You will need +- A Raspberry Pi computer connected to the internet +- [An up to date install of the Raspberry Pi OS](https://www.raspberrypi.org/downloads/) diff --git a/vi-VN/step_2.md b/vi-VN/step_2.md new file mode 100644 index 0000000..1cb6c47 --- /dev/null +++ b/vi-VN/step_2.md @@ -0,0 +1,110 @@ +## Set up an Apache web server + +Apache is a popular web server application you can install on the Raspberry Pi to allow it to serve web pages. + +On its own, Apache can serve HTML files over HTTP. With additional modules it can serve dynamic web pages using scripting languages such as PHP. + +### Install Apache + +--- task --- + +Open a terminal window by selecting **Accessories** > **Terminal** from the menu. + +--- /task --- + +--- task --- + +Type the following command into the terminal and press Enter to install `apache2` + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo apt install apache2 -y + +--- /code --- + +**Tip:** If you see an error, make sure you are using the latest version of Raspberry Pi OS. + +--- /task --- + + +### Test the web server + +By default, Apache puts a test HTML file in the web folder that you will be able to view from your Pi or another computer on your network. + +--- task --- + +Open Chromium by selecting **Internet** > **Chromium Web Browser** from the menu. + +--- /task --- + +--- task --- + +Type `localhost` in the address bar. + +--- /task --- + +You should see this in your browser window: + +![Apache it works](images/apache-it-works.png) + +This means you have Apache working! + +### Changing the default web page + +This default web page is just a HTML file on the file system. It is located at `/var/www/html/index.html`. + +--- task --- + +Type the following command in the terminal to change to the directory containing the HTML file: + +--- code --- +--- +language: bash +line_numbers: false +--- +cd /var/www/html + +--- /code --- + +--- /task --- + +--- task --- + +Open the `index.html` file using Thonny + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo thonny index.html + +--- /code --- + +--- /task --- + +--- task --- + +Delete the contents of the file, then type a short message and save your changes. + +--- /task --- + +--- task --- + +Go back to Chromium and refresh the browser. You will see your message appear on the web page. + +--- /task --- + +--- collapse --- +--- +title: Access the page from another device on the network +--- + +You can open your web page from any other computer on your network, using the IP address of your Raspberry Pi, e.g. `http://192.168.1.10`. + +To find out your Raspberry Pi's IP address, type `hostname -I` into the terminal window. + +--- /collapse --- diff --git a/vi-VN/step_3.md b/vi-VN/step_3.md new file mode 100644 index 0000000..4bb6e7f --- /dev/null +++ b/vi-VN/step_3.md @@ -0,0 +1,91 @@ +## Install PHP + +PHP is a **preprocessor**: it's code that runs when the server receives a request for a web page via a web browser. It works out what needs to be shown on the page, and then sends that page to the browser. + +--- task --- + +Type the following command in the terminal to install PHP: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo apt install php -y + +--- /code --- + +--- /task --- + +### Test PHP + +--- task --- + +Type this command to delete the `index.html` file from earlier: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo rm index.html + +--- /code --- + +--- /task --- + +--- task --- + +Create a new file called `index.php`: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo thonny index.php + +--- /code --- + +--- /task --- + +--- task --- + +In the Thonny code editor, type this PHP code into the file and save it. + +--- code --- +--- +language: php +line_numbers: false +--- + + +--- /code --- + +--- /task --- + +--- task --- + +Refresh your browser. You should see "hello world". This page is not dynamic, but it is still served by PHP. + +![hello world](images/apache-hello-world.png) + +--- /task --- + + +--- collapse --- +--- +title: I can only see PHP code +--- +If you see the raw PHP above instead of "hello world", use this command to reload and restart Apache: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo service apache2 restart + +--- /code --- + +--- /collapse --- diff --git a/vi-VN/step_4.md b/vi-VN/step_4.md new file mode 100644 index 0000000..cc6eae1 --- /dev/null +++ b/vi-VN/step_4.md @@ -0,0 +1,75 @@ +## Install MariaDB + +MariaDB is a popular database engine. Like PHP, it's widely used on web servers, which is why projects like WordPress use it, and why those projects are so popular. + + +--- task --- + +Type this command to install the MariaDB Server and PHP-MySQL packages: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo apt install mariadb-server php-mysql -y + +--- /code --- + +--- /task --- + +--- task --- + +Now restart Apache: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo service apache2 restart + +--- /code --- + +--- /task --- + +### Set up + +--- task --- + +Run the MySQL secure installation command in the terminal window. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo mysql_secure_installation + +--- /code --- + +--- /task --- + +--- task --- + +Go through the setup wizard using the following answers: + ++ `Enter current password for root (enter for none):` — press **Enter**. + ++ `Switch to unix_socket authentication [Y/n]` - Type in **N** and press **Enter** + ++ `Change the root password?` - Type in **Y** and press **Enter** + ++ `New password:` - Type in a password and press **Enter**, then repeat a second time. **Important:** remember this root password, as you will need it later to set up WordPress. + ++ `Remove anonymous users` - Type in **Y** + ++ `Disallow root login remotely` - Type in **Y** + ++ `Remove test database and access to it` - Type in **Y** + ++ `Reload privilege tables now` - Type in **Y** + +--- /task --- + +When complete, you will see the message `All done!` and `Thanks for using MariaDB!`. diff --git a/vi-VN/step_5.md b/vi-VN/step_5.md new file mode 100644 index 0000000..d34db90 --- /dev/null +++ b/vi-VN/step_5.md @@ -0,0 +1,109 @@ +## Download WordPress + +WordPress is a popular tool used to quickly create a website or blog with an easy to use editor for creating new content. + + +--- task --- + +In your terminal, make sure you are still in the directory `/var/www/html/` + +--- code --- +--- +language: bash +line_numbers: false +--- +cd /var/www/html/ + +--- /code --- + +--- /task --- + +--- task --- + +Delete all the files in the folder. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo rm * + +--- /code --- + +--- /task --- + +--- task --- + +Type this command to download WordPress + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo wget http://wordpress.org/latest.tar.gz + +--- /code --- + +--- /task --- + +--- task --- + +Extract the WordPress software: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo tar xzf latest.tar.gz + +--- /code --- + +--- /task --- + +--- task --- + +Move the contents of the extracted `wordpress` directory to the current directory. **Tip:** Make sure you type the whole command including the dot. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo mv wordpress/* . + +--- /code --- + +--- /task --- + +--- task --- + +Tidy up by removing the download, and the now empty `wordpress` directory. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo rm -rf wordpress latest.tar.gz + +--- /code --- + +--- /task --- + +---task --- + +Change the ownership of all these files to the Apache user: **Tip:** Make sure you type the whole command including the dot. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo chown -R www-data: . + +--- /code --- + +--- /task --- diff --git a/vi-VN/step_6.md b/vi-VN/step_6.md new file mode 100644 index 0000000..eefa5ec --- /dev/null +++ b/vi-VN/step_6.md @@ -0,0 +1,95 @@ +## Set up your WordPress Database + +--- task --- + +Run `mysql` in the terminal window: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo mysql -uroot -p + +--- /code --- + +--- /task --- + +--- task --- + +Enter the root password you created when you set up the database. + +You will see the message `Welcome to the MariaDB monitor` and then the `MariaDB [(none)]>` prompt. + +--- /task --- + +--- task --- + +At the `MariaDB [(none)]>` prompt, type: **Tip:** Don't forget to type the semicolon at the end. + +--- code --- +--- +language: sql +line_numbers: false +--- +create database wordpress; + +--- /code --- + + + +--- /task --- + +If this has been successful, you should see `Query OK, 1 row affected (0.00 sec)`. + +--- task --- + +At the MariaDB prompt, grant database privileges to the root user. Change `YOURPASSWORD` to the password you created before. + +--- code --- +--- +language: sql +line_numbers: false +--- + +GRANT ALL PRIVILEGES ON wordpress.* TO 'root'@'localhost' IDENTIFIED BY 'YOURPASSWORD'; + +--- /code --- + +--- /task --- + +--- task --- + +For the changes to take effect, you will need to flush the database privileges: + +--- code --- +--- +language: sql +line_numbers: false +--- +FLUSH PRIVILEGES; + +--- /code --- + +--- /task --- + +--- task --- + +Exit the MariaDB prompt with Ctrl + D. + +--- /task --- + +--- task --- + +Restart your Raspberry Pi by typing this command in the terminal: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo reboot + +--- /code --- + +--- /task --- diff --git a/vi-VN/step_7.md b/vi-VN/step_7.md new file mode 100644 index 0000000..be18128 --- /dev/null +++ b/vi-VN/step_7.md @@ -0,0 +1,155 @@ +## WordPress configuration + +--- task --- + +Once your Raspberry Pi has rebooted, open Chromium and type `localhost` into the address bar. + +You should see a WordPress page asking to pick your language. + +![WordPress select language](images/wordpress_language.png) + +--- /task --- + +--- task --- + +Select your language and click **Continue**. + +--- /task --- + +You will be presented with the WordPress welcome screen. + +![WordPress welcome screen](images/wordpress-welcome.png) + +--- task --- + +Click the **Let's go!** button. + +--- /task --- + +--- task --- + +Now fill out the basic site information as follows: **Tip:** Make sure you type `wordpress` in the first box as the text displayed is only a suggestion, the box is blank. + +``` +Database Name: wordpress +User Name: root +Password: +Database Host: localhost +Table Prefix: wp_ +``` + +Click **Submit** to proceed. + +--- /task --- + + +--- task --- + +Click the **Run the install** button. + +--- /task --- + +--- task --- + +Fill in the information you are asked for, then click the `Install WordPress` button. + +--- /task --- + +--- task --- + +Log in, using the account you just created. + +Now you're logged in and have your site set up, you can see the website by visiting your `http://localhost/wp-admin`. + +--- /task --- + + +### Friendly permalinks + +It's recommended that you change your permalink settings to make your URLs more friendly. + +--- task --- + +Log in to WordPress and go to the dashboard. + +--- /task --- + +--- task --- + +Go to **Setting**, then **Permalinks**. + +--- /task --- + +--- task --- + +Select the **Post name** option and click **Save Changes**. + +--- /task --- + +--- task --- + +Type the following command in a terminal to enable Apache's `rewrite` mod: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo a2enmod rewrite + +--- /code --- + +--- /task --- + +--- task --- + +Open the Apache configuration file + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo geany /etc/apache2/sites-available/000-default.conf + +--- /code --- + +--- /task --- + +--- task --- + +Add the following lines after line 1. + +--- code --- +--- +language: sql line_numbers: true line_number_start: 2 +line_highlights: 3-5 +--- + AllowOverride All + +--- /code --- + +--- /task --- + +--- task --- + +Save the file and close Geany. + +--- /task --- + +--- task --- + +In a terminal type the command to restart Apache: + + + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo service apache2 restart + +--- /code --- + +--- /task --- \ No newline at end of file diff --git a/vi-VN/step_8.md b/vi-VN/step_8.md new file mode 100644 index 0000000..2e023a0 --- /dev/null +++ b/vi-VN/step_8.md @@ -0,0 +1,17 @@ +## Challenge + +--- challenge --- + +--- task --- + +Add more pages to your website. + +--- /task --- + +--- task --- + +Install a different theme from the Appearance menu. + +--- /task --- + +--- /challenge --- diff --git a/vi-VN/step_9.md b/vi-VN/step_9.md new file mode 100644 index 0000000..fc5847a --- /dev/null +++ b/vi-VN/step_9.md @@ -0,0 +1,3 @@ +## What can you do now? + +You could try setting up a [Python web server with Flask](https://projects.raspberrypi.org/en/projects/python-web-server-with-flask) \ No newline at end of file diff --git a/zh-CN/images/Python-Webserver-with-Wordpress-TILE-01.png b/zh-CN/images/Python-Webserver-with-Wordpress-TILE-01.png new file mode 100644 index 0000000..f632634 Binary files /dev/null and b/zh-CN/images/Python-Webserver-with-Wordpress-TILE-01.png differ diff --git a/zh-CN/images/Python-Webserver-with-Wordpress.png b/zh-CN/images/Python-Webserver-with-Wordpress.png new file mode 100644 index 0000000..07b0191 Binary files /dev/null and b/zh-CN/images/Python-Webserver-with-Wordpress.png differ diff --git a/zh-CN/images/apache-hello-world.png b/zh-CN/images/apache-hello-world.png new file mode 100644 index 0000000..69fb339 Binary files /dev/null and b/zh-CN/images/apache-hello-world.png differ diff --git a/zh-CN/images/apache-it-works.png b/zh-CN/images/apache-it-works.png new file mode 100644 index 0000000..fb71d9f Binary files /dev/null and b/zh-CN/images/apache-it-works.png differ diff --git a/zh-CN/images/banner.png b/zh-CN/images/banner.png new file mode 100644 index 0000000..88a7bfb Binary files /dev/null and b/zh-CN/images/banner.png differ diff --git a/zh-CN/images/create-database.png b/zh-CN/images/create-database.png new file mode 100644 index 0000000..34c91f2 Binary files /dev/null and b/zh-CN/images/create-database.png differ diff --git a/zh-CN/images/hostname.png b/zh-CN/images/hostname.png new file mode 100644 index 0000000..bb50249 Binary files /dev/null and b/zh-CN/images/hostname.png differ diff --git a/zh-CN/images/hostname_annotated.png b/zh-CN/images/hostname_annotated.png new file mode 100644 index 0000000..27b2f08 Binary files /dev/null and b/zh-CN/images/hostname_annotated.png differ diff --git a/zh-CN/images/install_apache.png b/zh-CN/images/install_apache.png new file mode 100644 index 0000000..8b5dab8 Binary files /dev/null and b/zh-CN/images/install_apache.png differ diff --git a/zh-CN/images/wordpress-database-setup.png b/zh-CN/images/wordpress-database-setup.png new file mode 100644 index 0000000..a1b2a91 Binary files /dev/null and b/zh-CN/images/wordpress-database-setup.png differ diff --git a/zh-CN/images/wordpress-information_needed.png b/zh-CN/images/wordpress-information_needed.png new file mode 100644 index 0000000..8119d0a Binary files /dev/null and b/zh-CN/images/wordpress-information_needed.png differ diff --git a/zh-CN/images/wordpress-run-installation.png b/zh-CN/images/wordpress-run-installation.png new file mode 100644 index 0000000..b368d00 Binary files /dev/null and b/zh-CN/images/wordpress-run-installation.png differ diff --git a/zh-CN/images/wordpress-welcome.png b/zh-CN/images/wordpress-welcome.png new file mode 100644 index 0000000..9394739 Binary files /dev/null and b/zh-CN/images/wordpress-welcome.png differ diff --git a/zh-CN/images/wordpress_language.png b/zh-CN/images/wordpress_language.png new file mode 100644 index 0000000..4d44ba3 Binary files /dev/null and b/zh-CN/images/wordpress_language.png differ diff --git a/zh-CN/images/wp-info.png b/zh-CN/images/wp-info.png new file mode 100644 index 0000000..032e62e Binary files /dev/null and b/zh-CN/images/wp-info.png differ diff --git a/zh-CN/meta.yml b/zh-CN/meta.yml new file mode 100644 index 0000000..1eace43 --- /dev/null +++ b/zh-CN/meta.yml @@ -0,0 +1,42 @@ +--- +title: Build a LAMP Web Server with WordPress +hero_image: images/banner.png +description: Set up a local server for a website on your Raspberry Pi +original_url: https://raspberrypi.org/learning/lamp-web-server-with-wordpress +theme: turquoise +duration: 2 +listed: true +ingredient: false +copyedit: false +curriculum: 3, design-0, programming-3, phys-comp-0, manufacture-0, community-0 +interests: '' +technologies: raspberry-pi, html-css-javascript +site_areas: projects +hardware: raspberry-pi +software: html-css-javascript +version: 4 +last_tested: 2017-01-01 +steps: + - + title: 介绍 + - + title: Set up an Apache web server + completion: + - engaged + - + title: Install PHP + - + title: Install MariaDB + - + title: Download WordPress + - + title: Set up your WordPress database + completion: + - internal + - + title: WordPress configuration + completion: + - external + - + title: Challenge + challenge: true diff --git a/zh-CN/step_1.md b/zh-CN/step_1.md new file mode 100644 index 0000000..11ef2a3 --- /dev/null +++ b/zh-CN/step_1.md @@ -0,0 +1,12 @@ +## 你将制作: +Learn to set up a LAMP (**L**inux, **A**pache, **M**ySQL, **P**HP) stack on your Raspberry Pi and configure it to work as a web server. + + - Install software on your Raspberry Pi + - Install and configure Apache, PHP, and MySQL to create a LAMP web server + - Download WordPress and run it as a local website on your Raspberry Pi + - Configure WordPress and make your website accessible to other devices on your local network + + +### You will need +- A Raspberry Pi computer connected to the internet +- [An up to date install of the Raspberry Pi OS](https://www.raspberrypi.org/downloads/) diff --git a/zh-CN/step_2.md b/zh-CN/step_2.md new file mode 100644 index 0000000..1cb6c47 --- /dev/null +++ b/zh-CN/step_2.md @@ -0,0 +1,110 @@ +## Set up an Apache web server + +Apache is a popular web server application you can install on the Raspberry Pi to allow it to serve web pages. + +On its own, Apache can serve HTML files over HTTP. With additional modules it can serve dynamic web pages using scripting languages such as PHP. + +### Install Apache + +--- task --- + +Open a terminal window by selecting **Accessories** > **Terminal** from the menu. + +--- /task --- + +--- task --- + +Type the following command into the terminal and press Enter to install `apache2` + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo apt install apache2 -y + +--- /code --- + +**Tip:** If you see an error, make sure you are using the latest version of Raspberry Pi OS. + +--- /task --- + + +### Test the web server + +By default, Apache puts a test HTML file in the web folder that you will be able to view from your Pi or another computer on your network. + +--- task --- + +Open Chromium by selecting **Internet** > **Chromium Web Browser** from the menu. + +--- /task --- + +--- task --- + +Type `localhost` in the address bar. + +--- /task --- + +You should see this in your browser window: + +![Apache it works](images/apache-it-works.png) + +This means you have Apache working! + +### Changing the default web page + +This default web page is just a HTML file on the file system. It is located at `/var/www/html/index.html`. + +--- task --- + +Type the following command in the terminal to change to the directory containing the HTML file: + +--- code --- +--- +language: bash +line_numbers: false +--- +cd /var/www/html + +--- /code --- + +--- /task --- + +--- task --- + +Open the `index.html` file using Thonny + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo thonny index.html + +--- /code --- + +--- /task --- + +--- task --- + +Delete the contents of the file, then type a short message and save your changes. + +--- /task --- + +--- task --- + +Go back to Chromium and refresh the browser. You will see your message appear on the web page. + +--- /task --- + +--- collapse --- +--- +title: Access the page from another device on the network +--- + +You can open your web page from any other computer on your network, using the IP address of your Raspberry Pi, e.g. `http://192.168.1.10`. + +To find out your Raspberry Pi's IP address, type `hostname -I` into the terminal window. + +--- /collapse --- diff --git a/zh-CN/step_3.md b/zh-CN/step_3.md new file mode 100644 index 0000000..4bb6e7f --- /dev/null +++ b/zh-CN/step_3.md @@ -0,0 +1,91 @@ +## Install PHP + +PHP is a **preprocessor**: it's code that runs when the server receives a request for a web page via a web browser. It works out what needs to be shown on the page, and then sends that page to the browser. + +--- task --- + +Type the following command in the terminal to install PHP: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo apt install php -y + +--- /code --- + +--- /task --- + +### Test PHP + +--- task --- + +Type this command to delete the `index.html` file from earlier: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo rm index.html + +--- /code --- + +--- /task --- + +--- task --- + +Create a new file called `index.php`: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo thonny index.php + +--- /code --- + +--- /task --- + +--- task --- + +In the Thonny code editor, type this PHP code into the file and save it. + +--- code --- +--- +language: php +line_numbers: false +--- + + +--- /code --- + +--- /task --- + +--- task --- + +Refresh your browser. You should see "hello world". This page is not dynamic, but it is still served by PHP. + +![hello world](images/apache-hello-world.png) + +--- /task --- + + +--- collapse --- +--- +title: I can only see PHP code +--- +If you see the raw PHP above instead of "hello world", use this command to reload and restart Apache: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo service apache2 restart + +--- /code --- + +--- /collapse --- diff --git a/zh-CN/step_4.md b/zh-CN/step_4.md new file mode 100644 index 0000000..cc6eae1 --- /dev/null +++ b/zh-CN/step_4.md @@ -0,0 +1,75 @@ +## Install MariaDB + +MariaDB is a popular database engine. Like PHP, it's widely used on web servers, which is why projects like WordPress use it, and why those projects are so popular. + + +--- task --- + +Type this command to install the MariaDB Server and PHP-MySQL packages: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo apt install mariadb-server php-mysql -y + +--- /code --- + +--- /task --- + +--- task --- + +Now restart Apache: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo service apache2 restart + +--- /code --- + +--- /task --- + +### Set up + +--- task --- + +Run the MySQL secure installation command in the terminal window. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo mysql_secure_installation + +--- /code --- + +--- /task --- + +--- task --- + +Go through the setup wizard using the following answers: + ++ `Enter current password for root (enter for none):` — press **Enter**. + ++ `Switch to unix_socket authentication [Y/n]` - Type in **N** and press **Enter** + ++ `Change the root password?` - Type in **Y** and press **Enter** + ++ `New password:` - Type in a password and press **Enter**, then repeat a second time. **Important:** remember this root password, as you will need it later to set up WordPress. + ++ `Remove anonymous users` - Type in **Y** + ++ `Disallow root login remotely` - Type in **Y** + ++ `Remove test database and access to it` - Type in **Y** + ++ `Reload privilege tables now` - Type in **Y** + +--- /task --- + +When complete, you will see the message `All done!` and `Thanks for using MariaDB!`. diff --git a/zh-CN/step_5.md b/zh-CN/step_5.md new file mode 100644 index 0000000..d34db90 --- /dev/null +++ b/zh-CN/step_5.md @@ -0,0 +1,109 @@ +## Download WordPress + +WordPress is a popular tool used to quickly create a website or blog with an easy to use editor for creating new content. + + +--- task --- + +In your terminal, make sure you are still in the directory `/var/www/html/` + +--- code --- +--- +language: bash +line_numbers: false +--- +cd /var/www/html/ + +--- /code --- + +--- /task --- + +--- task --- + +Delete all the files in the folder. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo rm * + +--- /code --- + +--- /task --- + +--- task --- + +Type this command to download WordPress + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo wget http://wordpress.org/latest.tar.gz + +--- /code --- + +--- /task --- + +--- task --- + +Extract the WordPress software: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo tar xzf latest.tar.gz + +--- /code --- + +--- /task --- + +--- task --- + +Move the contents of the extracted `wordpress` directory to the current directory. **Tip:** Make sure you type the whole command including the dot. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo mv wordpress/* . + +--- /code --- + +--- /task --- + +--- task --- + +Tidy up by removing the download, and the now empty `wordpress` directory. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo rm -rf wordpress latest.tar.gz + +--- /code --- + +--- /task --- + +---task --- + +Change the ownership of all these files to the Apache user: **Tip:** Make sure you type the whole command including the dot. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo chown -R www-data: . + +--- /code --- + +--- /task --- diff --git a/zh-CN/step_6.md b/zh-CN/step_6.md new file mode 100644 index 0000000..eefa5ec --- /dev/null +++ b/zh-CN/step_6.md @@ -0,0 +1,95 @@ +## Set up your WordPress Database + +--- task --- + +Run `mysql` in the terminal window: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo mysql -uroot -p + +--- /code --- + +--- /task --- + +--- task --- + +Enter the root password you created when you set up the database. + +You will see the message `Welcome to the MariaDB monitor` and then the `MariaDB [(none)]>` prompt. + +--- /task --- + +--- task --- + +At the `MariaDB [(none)]>` prompt, type: **Tip:** Don't forget to type the semicolon at the end. + +--- code --- +--- +language: sql +line_numbers: false +--- +create database wordpress; + +--- /code --- + + + +--- /task --- + +If this has been successful, you should see `Query OK, 1 row affected (0.00 sec)`. + +--- task --- + +At the MariaDB prompt, grant database privileges to the root user. Change `YOURPASSWORD` to the password you created before. + +--- code --- +--- +language: sql +line_numbers: false +--- + +GRANT ALL PRIVILEGES ON wordpress.* TO 'root'@'localhost' IDENTIFIED BY 'YOURPASSWORD'; + +--- /code --- + +--- /task --- + +--- task --- + +For the changes to take effect, you will need to flush the database privileges: + +--- code --- +--- +language: sql +line_numbers: false +--- +FLUSH PRIVILEGES; + +--- /code --- + +--- /task --- + +--- task --- + +Exit the MariaDB prompt with Ctrl + D. + +--- /task --- + +--- task --- + +Restart your Raspberry Pi by typing this command in the terminal: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo reboot + +--- /code --- + +--- /task --- diff --git a/zh-CN/step_7.md b/zh-CN/step_7.md new file mode 100644 index 0000000..be18128 --- /dev/null +++ b/zh-CN/step_7.md @@ -0,0 +1,155 @@ +## WordPress configuration + +--- task --- + +Once your Raspberry Pi has rebooted, open Chromium and type `localhost` into the address bar. + +You should see a WordPress page asking to pick your language. + +![WordPress select language](images/wordpress_language.png) + +--- /task --- + +--- task --- + +Select your language and click **Continue**. + +--- /task --- + +You will be presented with the WordPress welcome screen. + +![WordPress welcome screen](images/wordpress-welcome.png) + +--- task --- + +Click the **Let's go!** button. + +--- /task --- + +--- task --- + +Now fill out the basic site information as follows: **Tip:** Make sure you type `wordpress` in the first box as the text displayed is only a suggestion, the box is blank. + +``` +Database Name: wordpress +User Name: root +Password: +Database Host: localhost +Table Prefix: wp_ +``` + +Click **Submit** to proceed. + +--- /task --- + + +--- task --- + +Click the **Run the install** button. + +--- /task --- + +--- task --- + +Fill in the information you are asked for, then click the `Install WordPress` button. + +--- /task --- + +--- task --- + +Log in, using the account you just created. + +Now you're logged in and have your site set up, you can see the website by visiting your `http://localhost/wp-admin`. + +--- /task --- + + +### Friendly permalinks + +It's recommended that you change your permalink settings to make your URLs more friendly. + +--- task --- + +Log in to WordPress and go to the dashboard. + +--- /task --- + +--- task --- + +Go to **Setting**, then **Permalinks**. + +--- /task --- + +--- task --- + +Select the **Post name** option and click **Save Changes**. + +--- /task --- + +--- task --- + +Type the following command in a terminal to enable Apache's `rewrite` mod: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo a2enmod rewrite + +--- /code --- + +--- /task --- + +--- task --- + +Open the Apache configuration file + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo geany /etc/apache2/sites-available/000-default.conf + +--- /code --- + +--- /task --- + +--- task --- + +Add the following lines after line 1. + +--- code --- +--- +language: sql line_numbers: true line_number_start: 2 +line_highlights: 3-5 +--- + AllowOverride All + +--- /code --- + +--- /task --- + +--- task --- + +Save the file and close Geany. + +--- /task --- + +--- task --- + +In a terminal type the command to restart Apache: + + + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo service apache2 restart + +--- /code --- + +--- /task --- \ No newline at end of file diff --git a/zh-CN/step_8.md b/zh-CN/step_8.md new file mode 100644 index 0000000..2e023a0 --- /dev/null +++ b/zh-CN/step_8.md @@ -0,0 +1,17 @@ +## Challenge + +--- challenge --- + +--- task --- + +Add more pages to your website. + +--- /task --- + +--- task --- + +Install a different theme from the Appearance menu. + +--- /task --- + +--- /challenge --- diff --git a/zh-CN/step_9.md b/zh-CN/step_9.md new file mode 100644 index 0000000..fc5847a --- /dev/null +++ b/zh-CN/step_9.md @@ -0,0 +1,3 @@ +## What can you do now? + +You could try setting up a [Python web server with Flask](https://projects.raspberrypi.org/en/projects/python-web-server-with-flask) \ No newline at end of file diff --git a/zh-TW/images/Python-Webserver-with-Wordpress-TILE-01.png b/zh-TW/images/Python-Webserver-with-Wordpress-TILE-01.png new file mode 100644 index 0000000..f632634 Binary files /dev/null and b/zh-TW/images/Python-Webserver-with-Wordpress-TILE-01.png differ diff --git a/zh-TW/images/Python-Webserver-with-Wordpress.png b/zh-TW/images/Python-Webserver-with-Wordpress.png new file mode 100644 index 0000000..07b0191 Binary files /dev/null and b/zh-TW/images/Python-Webserver-with-Wordpress.png differ diff --git a/zh-TW/images/apache-hello-world.png b/zh-TW/images/apache-hello-world.png new file mode 100644 index 0000000..69fb339 Binary files /dev/null and b/zh-TW/images/apache-hello-world.png differ diff --git a/zh-TW/images/apache-it-works.png b/zh-TW/images/apache-it-works.png new file mode 100644 index 0000000..fb71d9f Binary files /dev/null and b/zh-TW/images/apache-it-works.png differ diff --git a/zh-TW/images/banner.png b/zh-TW/images/banner.png new file mode 100644 index 0000000..88a7bfb Binary files /dev/null and b/zh-TW/images/banner.png differ diff --git a/zh-TW/images/create-database.png b/zh-TW/images/create-database.png new file mode 100644 index 0000000..34c91f2 Binary files /dev/null and b/zh-TW/images/create-database.png differ diff --git a/zh-TW/images/hostname.png b/zh-TW/images/hostname.png new file mode 100644 index 0000000..bb50249 Binary files /dev/null and b/zh-TW/images/hostname.png differ diff --git a/zh-TW/images/hostname_annotated.png b/zh-TW/images/hostname_annotated.png new file mode 100644 index 0000000..27b2f08 Binary files /dev/null and b/zh-TW/images/hostname_annotated.png differ diff --git a/zh-TW/images/install_apache.png b/zh-TW/images/install_apache.png new file mode 100644 index 0000000..8b5dab8 Binary files /dev/null and b/zh-TW/images/install_apache.png differ diff --git a/zh-TW/images/wordpress-database-setup.png b/zh-TW/images/wordpress-database-setup.png new file mode 100644 index 0000000..a1b2a91 Binary files /dev/null and b/zh-TW/images/wordpress-database-setup.png differ diff --git a/zh-TW/images/wordpress-information_needed.png b/zh-TW/images/wordpress-information_needed.png new file mode 100644 index 0000000..8119d0a Binary files /dev/null and b/zh-TW/images/wordpress-information_needed.png differ diff --git a/zh-TW/images/wordpress-run-installation.png b/zh-TW/images/wordpress-run-installation.png new file mode 100644 index 0000000..b368d00 Binary files /dev/null and b/zh-TW/images/wordpress-run-installation.png differ diff --git a/zh-TW/images/wordpress-welcome.png b/zh-TW/images/wordpress-welcome.png new file mode 100644 index 0000000..9394739 Binary files /dev/null and b/zh-TW/images/wordpress-welcome.png differ diff --git a/zh-TW/images/wordpress_language.png b/zh-TW/images/wordpress_language.png new file mode 100644 index 0000000..4d44ba3 Binary files /dev/null and b/zh-TW/images/wordpress_language.png differ diff --git a/zh-TW/images/wp-info.png b/zh-TW/images/wp-info.png new file mode 100644 index 0000000..032e62e Binary files /dev/null and b/zh-TW/images/wp-info.png differ diff --git a/zh-TW/meta.yml b/zh-TW/meta.yml new file mode 100644 index 0000000..d9672f2 --- /dev/null +++ b/zh-TW/meta.yml @@ -0,0 +1,42 @@ +--- +title: Build a LAMP Web Server with WordPress +hero_image: images/banner.png +description: Set up a local server for a website on your Raspberry Pi +original_url: https://raspberrypi.org/learning/lamp-web-server-with-wordpress +theme: turquoise +duration: 2 +listed: true +ingredient: false +copyedit: false +curriculum: 3, design-0, programming-3, phys-comp-0, manufacture-0, community-0 +interests: '' +technologies: raspberry-pi, html-css-javascript +site_areas: projects +hardware: raspberry-pi +software: html-css-javascript +version: 4 +last_tested: 2017-01-01 +steps: + - + title: 介紹 + - + title: Set up an Apache web server + completion: + - engaged + - + title: Install PHP + - + title: Install MariaDB + - + title: Download WordPress + - + title: Set up your WordPress database + completion: + - internal + - + title: WordPress configuration + completion: + - external + - + title: Challenge + challenge: true diff --git a/zh-TW/step_1.md b/zh-TW/step_1.md new file mode 100644 index 0000000..273e953 --- /dev/null +++ b/zh-TW/step_1.md @@ -0,0 +1,12 @@ +## 你將會製作出 +Learn to set up a LAMP (**L**inux, **A**pache, **M**ySQL, **P**HP) stack on your Raspberry Pi and configure it to work as a web server. + + - Install software on your Raspberry Pi + - Install and configure Apache, PHP, and MySQL to create a LAMP web server + - Download WordPress and run it as a local website on your Raspberry Pi + - Configure WordPress and make your website accessible to other devices on your local network + + +### You will need +- A Raspberry Pi computer connected to the internet +- [An up to date install of the Raspberry Pi OS](https://www.raspberrypi.org/downloads/) diff --git a/zh-TW/step_2.md b/zh-TW/step_2.md new file mode 100644 index 0000000..1cb6c47 --- /dev/null +++ b/zh-TW/step_2.md @@ -0,0 +1,110 @@ +## Set up an Apache web server + +Apache is a popular web server application you can install on the Raspberry Pi to allow it to serve web pages. + +On its own, Apache can serve HTML files over HTTP. With additional modules it can serve dynamic web pages using scripting languages such as PHP. + +### Install Apache + +--- task --- + +Open a terminal window by selecting **Accessories** > **Terminal** from the menu. + +--- /task --- + +--- task --- + +Type the following command into the terminal and press Enter to install `apache2` + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo apt install apache2 -y + +--- /code --- + +**Tip:** If you see an error, make sure you are using the latest version of Raspberry Pi OS. + +--- /task --- + + +### Test the web server + +By default, Apache puts a test HTML file in the web folder that you will be able to view from your Pi or another computer on your network. + +--- task --- + +Open Chromium by selecting **Internet** > **Chromium Web Browser** from the menu. + +--- /task --- + +--- task --- + +Type `localhost` in the address bar. + +--- /task --- + +You should see this in your browser window: + +![Apache it works](images/apache-it-works.png) + +This means you have Apache working! + +### Changing the default web page + +This default web page is just a HTML file on the file system. It is located at `/var/www/html/index.html`. + +--- task --- + +Type the following command in the terminal to change to the directory containing the HTML file: + +--- code --- +--- +language: bash +line_numbers: false +--- +cd /var/www/html + +--- /code --- + +--- /task --- + +--- task --- + +Open the `index.html` file using Thonny + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo thonny index.html + +--- /code --- + +--- /task --- + +--- task --- + +Delete the contents of the file, then type a short message and save your changes. + +--- /task --- + +--- task --- + +Go back to Chromium and refresh the browser. You will see your message appear on the web page. + +--- /task --- + +--- collapse --- +--- +title: Access the page from another device on the network +--- + +You can open your web page from any other computer on your network, using the IP address of your Raspberry Pi, e.g. `http://192.168.1.10`. + +To find out your Raspberry Pi's IP address, type `hostname -I` into the terminal window. + +--- /collapse --- diff --git a/zh-TW/step_3.md b/zh-TW/step_3.md new file mode 100644 index 0000000..4bb6e7f --- /dev/null +++ b/zh-TW/step_3.md @@ -0,0 +1,91 @@ +## Install PHP + +PHP is a **preprocessor**: it's code that runs when the server receives a request for a web page via a web browser. It works out what needs to be shown on the page, and then sends that page to the browser. + +--- task --- + +Type the following command in the terminal to install PHP: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo apt install php -y + +--- /code --- + +--- /task --- + +### Test PHP + +--- task --- + +Type this command to delete the `index.html` file from earlier: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo rm index.html + +--- /code --- + +--- /task --- + +--- task --- + +Create a new file called `index.php`: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo thonny index.php + +--- /code --- + +--- /task --- + +--- task --- + +In the Thonny code editor, type this PHP code into the file and save it. + +--- code --- +--- +language: php +line_numbers: false +--- + + +--- /code --- + +--- /task --- + +--- task --- + +Refresh your browser. You should see "hello world". This page is not dynamic, but it is still served by PHP. + +![hello world](images/apache-hello-world.png) + +--- /task --- + + +--- collapse --- +--- +title: I can only see PHP code +--- +If you see the raw PHP above instead of "hello world", use this command to reload and restart Apache: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo service apache2 restart + +--- /code --- + +--- /collapse --- diff --git a/zh-TW/step_4.md b/zh-TW/step_4.md new file mode 100644 index 0000000..cc6eae1 --- /dev/null +++ b/zh-TW/step_4.md @@ -0,0 +1,75 @@ +## Install MariaDB + +MariaDB is a popular database engine. Like PHP, it's widely used on web servers, which is why projects like WordPress use it, and why those projects are so popular. + + +--- task --- + +Type this command to install the MariaDB Server and PHP-MySQL packages: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo apt install mariadb-server php-mysql -y + +--- /code --- + +--- /task --- + +--- task --- + +Now restart Apache: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo service apache2 restart + +--- /code --- + +--- /task --- + +### Set up + +--- task --- + +Run the MySQL secure installation command in the terminal window. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo mysql_secure_installation + +--- /code --- + +--- /task --- + +--- task --- + +Go through the setup wizard using the following answers: + ++ `Enter current password for root (enter for none):` — press **Enter**. + ++ `Switch to unix_socket authentication [Y/n]` - Type in **N** and press **Enter** + ++ `Change the root password?` - Type in **Y** and press **Enter** + ++ `New password:` - Type in a password and press **Enter**, then repeat a second time. **Important:** remember this root password, as you will need it later to set up WordPress. + ++ `Remove anonymous users` - Type in **Y** + ++ `Disallow root login remotely` - Type in **Y** + ++ `Remove test database and access to it` - Type in **Y** + ++ `Reload privilege tables now` - Type in **Y** + +--- /task --- + +When complete, you will see the message `All done!` and `Thanks for using MariaDB!`. diff --git a/zh-TW/step_5.md b/zh-TW/step_5.md new file mode 100644 index 0000000..d34db90 --- /dev/null +++ b/zh-TW/step_5.md @@ -0,0 +1,109 @@ +## Download WordPress + +WordPress is a popular tool used to quickly create a website or blog with an easy to use editor for creating new content. + + +--- task --- + +In your terminal, make sure you are still in the directory `/var/www/html/` + +--- code --- +--- +language: bash +line_numbers: false +--- +cd /var/www/html/ + +--- /code --- + +--- /task --- + +--- task --- + +Delete all the files in the folder. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo rm * + +--- /code --- + +--- /task --- + +--- task --- + +Type this command to download WordPress + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo wget http://wordpress.org/latest.tar.gz + +--- /code --- + +--- /task --- + +--- task --- + +Extract the WordPress software: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo tar xzf latest.tar.gz + +--- /code --- + +--- /task --- + +--- task --- + +Move the contents of the extracted `wordpress` directory to the current directory. **Tip:** Make sure you type the whole command including the dot. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo mv wordpress/* . + +--- /code --- + +--- /task --- + +--- task --- + +Tidy up by removing the download, and the now empty `wordpress` directory. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo rm -rf wordpress latest.tar.gz + +--- /code --- + +--- /task --- + +---task --- + +Change the ownership of all these files to the Apache user: **Tip:** Make sure you type the whole command including the dot. + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo chown -R www-data: . + +--- /code --- + +--- /task --- diff --git a/zh-TW/step_6.md b/zh-TW/step_6.md new file mode 100644 index 0000000..eefa5ec --- /dev/null +++ b/zh-TW/step_6.md @@ -0,0 +1,95 @@ +## Set up your WordPress Database + +--- task --- + +Run `mysql` in the terminal window: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo mysql -uroot -p + +--- /code --- + +--- /task --- + +--- task --- + +Enter the root password you created when you set up the database. + +You will see the message `Welcome to the MariaDB monitor` and then the `MariaDB [(none)]>` prompt. + +--- /task --- + +--- task --- + +At the `MariaDB [(none)]>` prompt, type: **Tip:** Don't forget to type the semicolon at the end. + +--- code --- +--- +language: sql +line_numbers: false +--- +create database wordpress; + +--- /code --- + + + +--- /task --- + +If this has been successful, you should see `Query OK, 1 row affected (0.00 sec)`. + +--- task --- + +At the MariaDB prompt, grant database privileges to the root user. Change `YOURPASSWORD` to the password you created before. + +--- code --- +--- +language: sql +line_numbers: false +--- + +GRANT ALL PRIVILEGES ON wordpress.* TO 'root'@'localhost' IDENTIFIED BY 'YOURPASSWORD'; + +--- /code --- + +--- /task --- + +--- task --- + +For the changes to take effect, you will need to flush the database privileges: + +--- code --- +--- +language: sql +line_numbers: false +--- +FLUSH PRIVILEGES; + +--- /code --- + +--- /task --- + +--- task --- + +Exit the MariaDB prompt with Ctrl + D. + +--- /task --- + +--- task --- + +Restart your Raspberry Pi by typing this command in the terminal: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo reboot + +--- /code --- + +--- /task --- diff --git a/zh-TW/step_7.md b/zh-TW/step_7.md new file mode 100644 index 0000000..be18128 --- /dev/null +++ b/zh-TW/step_7.md @@ -0,0 +1,155 @@ +## WordPress configuration + +--- task --- + +Once your Raspberry Pi has rebooted, open Chromium and type `localhost` into the address bar. + +You should see a WordPress page asking to pick your language. + +![WordPress select language](images/wordpress_language.png) + +--- /task --- + +--- task --- + +Select your language and click **Continue**. + +--- /task --- + +You will be presented with the WordPress welcome screen. + +![WordPress welcome screen](images/wordpress-welcome.png) + +--- task --- + +Click the **Let's go!** button. + +--- /task --- + +--- task --- + +Now fill out the basic site information as follows: **Tip:** Make sure you type `wordpress` in the first box as the text displayed is only a suggestion, the box is blank. + +``` +Database Name: wordpress +User Name: root +Password: +Database Host: localhost +Table Prefix: wp_ +``` + +Click **Submit** to proceed. + +--- /task --- + + +--- task --- + +Click the **Run the install** button. + +--- /task --- + +--- task --- + +Fill in the information you are asked for, then click the `Install WordPress` button. + +--- /task --- + +--- task --- + +Log in, using the account you just created. + +Now you're logged in and have your site set up, you can see the website by visiting your `http://localhost/wp-admin`. + +--- /task --- + + +### Friendly permalinks + +It's recommended that you change your permalink settings to make your URLs more friendly. + +--- task --- + +Log in to WordPress and go to the dashboard. + +--- /task --- + +--- task --- + +Go to **Setting**, then **Permalinks**. + +--- /task --- + +--- task --- + +Select the **Post name** option and click **Save Changes**. + +--- /task --- + +--- task --- + +Type the following command in a terminal to enable Apache's `rewrite` mod: + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo a2enmod rewrite + +--- /code --- + +--- /task --- + +--- task --- + +Open the Apache configuration file + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo geany /etc/apache2/sites-available/000-default.conf + +--- /code --- + +--- /task --- + +--- task --- + +Add the following lines after line 1. + +--- code --- +--- +language: sql line_numbers: true line_number_start: 2 +line_highlights: 3-5 +--- + AllowOverride All + +--- /code --- + +--- /task --- + +--- task --- + +Save the file and close Geany. + +--- /task --- + +--- task --- + +In a terminal type the command to restart Apache: + + + +--- code --- +--- +language: bash +line_numbers: false +--- +sudo service apache2 restart + +--- /code --- + +--- /task --- \ No newline at end of file diff --git a/zh-TW/step_8.md b/zh-TW/step_8.md new file mode 100644 index 0000000..2e023a0 --- /dev/null +++ b/zh-TW/step_8.md @@ -0,0 +1,17 @@ +## Challenge + +--- challenge --- + +--- task --- + +Add more pages to your website. + +--- /task --- + +--- task --- + +Install a different theme from the Appearance menu. + +--- /task --- + +--- /challenge --- diff --git a/zh-TW/step_9.md b/zh-TW/step_9.md new file mode 100644 index 0000000..fc5847a --- /dev/null +++ b/zh-TW/step_9.md @@ -0,0 +1,3 @@ +## What can you do now? + +You could try setting up a [Python web server with Flask](https://projects.raspberrypi.org/en/projects/python-web-server-with-flask) \ No newline at end of file