 Note that there's some introduction or welcome message shown here. It actually gives us some useful information, but we'll come back to that later. When you log into a machine, it shows some welcome message. And in this case, there's some important information here, but we'll come to that in a moment. First, let's just test. When we set up our droplet, I chose the lamp option, Ubuntu using lamp. We'll automatically install the web server. Let's test. On your computer, open your browser and visit your website. How do you visit your website? So open your browser on your lab computer and visit the website of your VPS. Note, our server doesn't have a domain name. There's no www.abc.com. It's only got an IP address. You need to type the IP address of your server into your web browser address bar. So you need to find your IP address. I'll use ifconfig. ifconfig.et80 to get the exact one I want. Copy and paste my IP address into my browser. Enter. It shows me a web page. If you get to this web page, the default web server is set up. The web server is called Apache or Apache version 2. This just gives you some configuration information about the web server. If you don't get that, you have a problem. Anyone? We don't want this default page. We're going to delete it. In the future, you can create your own web page to go there. But we'll create a placeholder. So where are the web pages on your computer? If you now change into the directory, slash var, slash www, slash html. Last week, we introduced some of you to the command line and we saw CD was the way to change a directory. And this changes into this directory under the root of the hierarchy, var under that, www, and then html. And to list the files, ls. And we see there are two files. The base of the web server, the base directory. So when we visited that web site, the file that was displayed, and you can check the contents, index.html. You can open up index.html in an editor. Or you can, oh, not yet. You're too far ahead. So you can open up the index.html in an editor and see the actual html and notice that there's a lot of CSS there. Scroll down and see it's that web page that was displayed when you visited your server via the browser. That is the actual web page. We don't want that one. Let's delete it. To delete a file, we use rm. rm removes the file. We don't want that default one. Let's get a better one. rm index.html and enter index.d. rm index.html, enter what happens. What's this? A warning message. Do you really want to remove this file? It's protected. Yes, I do. I cannot, permission denied. So the file is still there. You couldn't delete. I wanted to delete index.html. It gave me some warning. And then it said permission denied, which is an error message. You couldn't delete. We're still there. This is due to the user. By default, the web pages in this web directory are only accessible by the administrator or a special type of users. I am not. I'm logged in as Steve, not the administrator. So I want to switch and delete this file as the administrator. And the administrator in Linux is called the super user. So I want to do this command as the super user. And we hit sudo rm index.html. Do this command as super user. Run as administrator. It will ask you for your password. You need to supply it once, and then it will save it for a while. And then there should be no warning messages. And now the file's gone. We've deleted the file. While we're here, let's delete the info file. It's just a PHP. It gives us some information about PHP. We don't need it. sudo rm. So if you need to run a command as the administrator, you proceed that command with sudo. If we didn't add you to the sudo group, it wouldn't allow you to run the command as sudo. And now let's add a new web page. And again, to write a file, we'll need to use sudo. sudo nano index.html. That is, open a new file called index.html in my text editor nano and do this as the super user. sudo nano index.html. And create your web page. Everyone knows HTML. If you're lazy, then copy and paste it from my web page. And today I'm lazy. Create your web page and maybe change the title or the content. Just a simple web page. Copy and paste and put your name in it. So you know this is your website. Save the file, control X. Control X, yes. And then enter. And then open your browser and visit your website again. Just to check that your web page is working. So once you can visit your website, save your file. We now have the index.html and open your browser. And in my case, I'm going to refresh. So you have your own website. And I think that's all we're going to cover regarding the web server. I'm not going to show how to create a website. I think everyone, if they want to create a website, they will find out how to do it if they don't already know. You can do a very basic website, just some HTML. At the end, if we get time, we may show using PHP in a database. This PHP is installed. MySQL database server is installed. We'll set that up in a moment so you can create dynamic web pages. Or if you want a more advanced website, you can install things like WordPress, Joomla, Drupal or other software that creates a website for you. Or you can just create a very simple website where you put a list of files in this directory and it gives you access to those files. A very basic file sharing website. Make sure you refresh to C. Let's go home. Cd, what's next? Bring back my instructions. The MySQL database server, especially if you create dynamic websites, is useful to have a database server. MySQL is a very popular free database server. It's already installed. We have a LAN package, but we need to do some things to set it up and we'll create an example database. So let's do that now. Make sure you're home. Go home, remember just Cd. MySQL, the database server has its own concept of users, including a root user. But be careful, MySQL users are separate from our operating system users. So there's a root user on my operating system. There's also a root user for MySQL. They're completely separate, even though their names are the same, different passwords, different system. To set up the database server, we need to know the root password of MySQL. And it's actually shown in the welcome message. And to see the welcome message, it's called the message of the day. And the message of the day is installed in this directory and we can display it, or the end of it, the tail of that message of the day. Cat, ETC, MOTD dot tail. And you'll see something about MySQL in there. This was created by the digital ocean software when it created the droplet. It's not always the case when you install an operating system. Note the password. Note and remember it. So in my case, this QNRD, yours will be different. Now let's change that password. MySQL admin, minus U, the root user, minus P, and then password. This is a program to administrate the database to change the password. Go on. What are you trying to do? It's not there. So if you want to add a new file, sudo nano index. sudo nano. And copy and paste from the website and say, MySQL admin allows us to change some system, some database server parameters. This is going to change the password. Enter the one in the message. This QNR, yours will be different. And now choose a new password for the root user. Now we've got our third password. Again, it's good not to use the same password. Don't use the same password as the root user for your operating system. That makes it a little bit inconvenient. Now you need to remember three. Don't worry, there'll be another one added soon. There'll be four. Sorry, I can't remember either. What have we got? So we changed the MySQL root user password. Not the root user of the operating system. Sometimes it's useful to write that one down if you need it later. Let's remove this message, this welcome message. The welcome message is only there for the startup. Let's remove it. So others don't see it in the future. Pseudo, RM, then the file name. Keep going. There's a nice software that is mentioned here, MySQL secure installation, which will do a few things to make our database server a little bit more secure. Let's run that. Run it. Pseudo, MySQL secure installation. It's listed in the welcome message up above. It's just a special script to clean out the database from some test databases and check a few things. You can copy and paste it from the welcome message. And I'll ask you some questions. Enter the current password for root, the one you just changed it to. And I remember mine. Do you want to change the root password? No, not again. I've just changed it. No. And the others, yes, yes, yes, or default. Remove anonymous users, yes. Disallow root, login, yes. Remove test database, yes. Reload, yes. Done. All right, a bit fast if you didn't follow then, but this just adds, makes it a little bit more secure than the database server. Now, let's create a database. We may get a chance to use it later, but let's just create one quickly. We'll need to create a user as well. So we have the root user for MySQL. We'll need to create a new user that can access a particular database. MySQL user root minus P means we'll prompt for the password, give us the password. So enter the MySQL root user password. And now we have a MySQL prompt. And those people that haven't taken database systems with Dr. Tanner up, if you haven't taken it, you'll take it probably this semester. I look at most of you this semester. Yeah, this semester. And you'll learn all this. Okay. If you don't know, then some of it's quite obvious. Create a database, give it a name. I've just copied from somewhere else. Create database called example DB. You can call it something else. Doesn't matter. And now create a new user that has permissions, all permissions on that database. And you can, again, you can copy and paste from the website if you don't want to type this. You don't need to know the full syntax. Grant all permissions on this database and all the tables to a particular user. And now we're going to add a new user. We have the database root user. Let's add a new one. And for me, I'm going to call my database user student. You can do the same or you can use a different one. And student is identified by some password. Well, I can't remember all my passwords. I'm going to set it the same. Grant permissions, all permissions to this database to the user student who will use the password student. Okay, not very secure, but it's not so important at this stage for our server. And you need a semicolon at the end. So be careful. There's a semicolon on the end. If you press enter before that, then you'll have to add the semicolon. Granted some permissions, so we must update them. It's called flush privileges. And then quit our database, which means there's a database and we're not going to look at it at the moment. Maybe we'll get time at the end to use it. But this is just a quick example of creating a database and creating a user. Questions?