This article is written by a Gachi amateur who is just beginning to learn about CUI and CLI command input on the Linux distribution Ubuntu 20.04.
-Ubuntu 20.04 LTS ・ XAMPP for Linux 7.4.6-0
The XAMPP document root is the htdocs folder.
/opt/lampp/htdocs/
Type the following command to open the application.
sudo /opt/lampp/manager-linux-x64.run
After that, click Go To Application and you will be asked if you want to run the server. Click Start Servers to start XAMPP.
Use mkdir
to create a folder.
/ opt / lampp / htdocs /
.
mkdir /opt/lampp/htdocs/website/
Use chmod
to change the permissions of a folder so that it can be written.
Set permissions to 777 to allow all users to write and save.
It's a command with the obscure meaning that -R
changes recursively.
chmod -R 777 /opt/lampp/htdocs/website/
If you visit the site and get an error, try this command first.
To create a new file, enter the touch
command.
in
/ opt / lampp / htdocs / website / `of XAMPP.
touch /opt/lampp/htdocs/website/index.html
To edit a pre-existing file, use the vi
command.
vi /opt/lampp/htdocs/website/index.html
When ʻindex.html opens, edit the command. Press the ʻi
key.
Then you will be in edit mode. Select with the cursor and enter the HTML.
index.html
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="./style.css" type="text/css">
<title>Louis Alexa website</title>
</head>
<body>
<h1>Louis Alexa website</h1>
<h2>What is the Louis Alexa site?</h2>
<p>
This is the Louis Alexa website.<br>
</p>
</body>
</html>
When you're done, press Esc to exit edit mode, then type the command : wq
and press Enter.
w
means to save the command. It means that q
ends.
In addition, it is a command that means to save and exit.
By the way, let's create style.css
.
touch /opt/lampp/htdocs/website/style.css
vi /opt/lampp/htdocs/website/style.css
style.css
body{
background-color:#000000;
color:#FFFFFF;
}
Press the Esc key to restore the mode.
Then press : wq
to save.
By doing so, you can access the following URL. http://localhost/website/index.html
Combine sudo
and -s
.
sudo -s
If you type the above command while you are not logged in, you will be prompted to enter the root password. Type in your password. Then you can start it with root privileges.