[LINUX] [XAMPP 7.4.6-0 environment] Memo about command input of CUI and CLI in Ubuntu 20.04 written by Gachi amateur

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.

environment

-Ubuntu 20.04 LTS ・ XAMPP for Linux 7.4.6-0

Points to remember

The XAMPP document root is the htdocs folder.

/opt/lampp/htdocs/

Preparation

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.

1. Create a folder

Use mkdir to create a folder. Create a folder website in / opt / lampp / htdocs /.

mkdir /opt/lampp/htdocs/website/

2. Change folder permissions

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.

3. Create a new file

To create a new file, enter the touch command. Create a file called ʻindex.html in / opt / lampp / htdocs / website / `of XAMPP.

touch /opt/lampp/htdocs/website/index.html

4. Edit the file

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

[Supplement] To start with root privileges

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.

Recommended Posts

[XAMPP 7.4.6-0 environment] Memo about command input of CUI and CLI in Ubuntu 20.04 written by Gachi amateur