Table of Contents
I bought the wrong movie ticket and had to watch it with tears in my eyes - LAMP setup & Linux basics, movie tickets-lamp
Home Backend Development PHP Tutorial I bought the wrong movie ticket and had to watch it with tears in my eyes - LAMP setup & Linux basics, movie tickets - lamp_PHP tutorial

I bought the wrong movie ticket and had to watch it with tears in my eyes - LAMP setup & Linux basics, movie tickets - lamp_PHP tutorial

Jul 12, 2016 am 09:04 AM
ubuntu

I bought the wrong movie ticket and had to watch it with tears in my eyes - LAMP setup & Linux basics, movie tickets-lamp

 hi

I never mentioned that my roommate had a birthday treat last Friday. We had a good time eating and drinking at Longhu, and we talked about it on the way back. We agreed to watch the last blockbuster movie of the year together this week, The Martian. Who knew that I had bad eyesight and bought the movie at the wrong time. . . I moved up my Saturday appointment to this afternoon, madan, I couldn’t even send it off, so I had to go and see it

1. LAMP

-----Building a LAMP environment (2)-----

----Add common extensions to PHP

Go to the Internet to find the gd and curl commands. This is too long

liang@liang-andy:~$ sudo apt-get install php5-gd curl libcurl3-dev php5-curl
It takes a bit long

To verify, you must first restart the apache2 service, and then go to the probe file mentioned last time, that is, check if there is anything in phpinfo

----filezilla

ssh tool, manage server files

-----LAMP environment configuration optimization (1)-----

----LAMP environment file overview

Common sense

/etc--Ubuntu system configuration file directory. Generally, the configuration files of software installed through the apt-get command are here

LAMP is here too

/etc/apache2

/etc/mysql

/etc/php5

----Detailed explanation of environment files

---

Open the apache2 file list first

liang@liang-andy:~$ cd /etc/apache2
liang@liang-andy:/etc/apache2$ ll
Total usage 96
drwxr-xr-x 8 root root 4096 11 November 23 19:08 ./
drwxr-xr-x 134 root root 12288 November 25 12:37 ../
-rw-r--r-- 1 root root 7115 January 7 2014 apache2. conf
drwxr-xr-x 2 root root 4096 November 23 19:08 conf-available/
drwxr-xr-x 2 root root 4096 November 23 19:08 conf-enabled/
-rw -r--r-- 1 root root 1782 January 3 2014 envvars
-rw-r--r-- 1 root root 31063 January 3 2014 magic
drwxr-xr-x 2 root root 12288 11 November 23 19:21 mods-available/
drwxr-xr-x 2 root root 4096 November 23 19:21 mods-enabled/
-rw-r--r-- 1 root root 320 January 7 2014 ports.conf
drwxr-xr-x 2 root root 4096 November 23 19:08 sites-available/
drwxr-xr-x 2 root root 4096 November 23 19:08 sites-enabled/

There is apache.conf in apache2, which is the general entrance of the configuration file. It can include many other configuration files - it is more flexible to configure, and the total file is not very big

Core configuration: mods-*** apache module; sites-*** virtual host

***You can use available (available) and enabled (enabled) (see the last column of the command above for details)

Use the ln -s command to make a soft connection between enabled and avaliable. It is equivalent to saying that the module itself is like a light, and the command is a switch

---

mysql and php

The core are my.cnf and php.ini

More details later

2. Linux basics

The environment is centOS6 in the virtual machine VM and the ssh tool xshell5

Shortcut key, ctrl l

-----Common Linux commands (1)-----

We need to master about 6 or 70, and there may be a total of 200 used in the future

[root@andy ~]#

User@hostname ~Current location (folder) #Super user prompt $Normal user prompt

Note that the user in Linux is not admin; the default host name is localhost; ~ means /root, abbreviated as home

[root@andy ~]# cd /root address is unchanged

The home directory of ordinary users is the secondary address

----Command format

Command [options] [parameters]

Note that individual commands do not follow this format; multiple options can be written together, such as -au; there are simplified options and complete options, such as -a and -all

---ls: Query files in the directory

ls [] [files and directories]

-a all Show all files, including hidden files

-l long displays detailed information, also known as long format

-d direct directory attribute

-h human displays the size that humans can understand

-i innode

[root@andy ~]# ls -al
Total usage 80
dr-xr-x---. 2 root root 4096 November 25 05:06 .
dr-xr-xr -x. 24 root root 4096 November 26 03:41 ..
-rw-------. 1 root root 1272 November 25 03:55 anaconda-ks.cfg
-rw-- -----. 1 root root 183 November 25 05:06 .bash_history
-rw-r--r--. 1 root root 18 May 20 2009 .bash_logout
-rw-r-- r--. 1 root root 176 May 20 2009 .bash_profile
-rw-r--r--. 1 root root 176 Sep 23 2004 .bashrc
-rw-r--r--. 1 root root 100 September 23 2004 .cshrc
-rw-r--r--. 1 root root 26420 November 25 03:55 install.log
-rw-r--r--. 1 root root 7572 November 25 03:52 install.log.syslog
-rw-r--r--. 1 root root 129 December 4 2004 .tcshrc
-rw------. 1 root root 768 November 25 04:20 .viminfo

--ll command, which is ls -l

--About long format

--First column, permissions

-rw-r--r-- refers to permissions; the default is 10 digits.

-Indicates the file type (-file d directory | soft link file) - there are 7 types in total. Others are rarely used, so ignore them for now. They are system special files. General users don’t need to worry about them. If you want to see them

[root@andy ~]# ls -l /dev/

The next 9 digits, every 3 are in a group, representing the u owner of the file, the group to which g belongs, and o other people's three identities (the file and the permissions regulations of the three)

(Linux user group is a set of users with the same permissions)

r read, w write, x execute (these are the three basic permissions)

For example, rw-u has read and write permissions on it

--dot "."

Represents ACL permissions

--Number 1

Reference Count

--root root

Owner and group

--Number

File size in bytes, use the -h option

[root@andy ~]# ls -lh
Total usage 44K
-rw-------. 1 root root 1.3K November 25 03:55 anaconda-ks.cfg
-rw-r--r--. 1 root root 26K November 25 03:55 install.log
-rw-r--r--. 1 root root 7.4K November 25 03:52 install. log.syslog

--Date

Last modification time

--Finally,

File name

File names starting with "." are hidden files

-- -d

Look at the permissions of the directory itself

-- -i

Display i node, id number

----File processing commands

Create directories and files

---Directory processing commands & file processing commands

Directories are also files, please clarify them first.

--Create directory: mkdir

make directory

mkdir -p [directory name]

-p creates recursively, which means that if you want to create a multi-level directory, create it recursively

[root@andy ~]# mkdir -p japan/cangls

---Switch directory: cd

cd [directory]

It’s very simple. You can switch to many levels or one level. You don’t need to enter the directory and just go back to the directory

-Simplified operation

cd or cd ~ Home (~ originally represents the home directory)

cd .. Return to the previous directory

cd - enter the last directory

cd . Enter the current directory

[root@andy ~]#
[root@andy ~]# cd /etc
[root@andy etc]# cd sysconfig
[root@andy sysconfig]# cd..
-bash: cd..: command not found
[root@andy sysconfig]# cd ..
[root@andy etc]# cd -
/etc/sysconfig
[root@andy sysconfig]# cd ~
[root@andy ~]#

--

Relative paths and absolute paths

[root@andy ~]# cd ../usr/local/src
[root@andy src]# cd ../usr/local/src
-bash: cd: ../usr /local/src: No such file or directory
[root@andy src]# cd /usr/local/src
[root@andy src]# cd /usr/local/src
[root@ andy src]#

Relative path means cd relative to the current location

The absolute path is to start from the root directory, which is troublesome but reliable, suitable for beginners

--About the tab key

Complete the command and directory, press the key twice, the judgment is correct

--Query the directory location: pwd

Use directly

--Delete empty directories: rmdir

remove empty directory

rmdir [directory]

[root@andy ~]# rmdir bols
[root@andy ~]# rmdir japan
rmdir: Failed to delete "japan": Directory is not empty

So it’s not easy to use, just know it

--Delete files or directories: rm

remove

[root@andy ~]# rm japan
rm: Unable to delete "japan": It is a directory
[root@andy ~]# rm -r japan
rm: Whether to enter the directory "japan" "? y
rm: Delete the directory "japan/cangls"? y^Hn^H^H^H
rm: Delete directory "japan"? n
[root@andy ~]# rm -rf japan
[root@andy ~]# ls -l
Total usage 44
-rw-------. 1 root root 1272 November 25 03:55 anaconda-ks.cfg
-rw-r--r--. 1 root root 26420 November 25 03:55 install.log
-rw-r--r-- . 1 root root 7572 November 25 03:52 install.log.syslog
[root@andy ~]#

rm -rf [directory]

If you delete directly with -rf, it will be deleted directly without asking any questions, so use it with caution, it may even delete the entire system

-r delete directory

-f force

--Copy: cp

copy

-r copy directory

-p -d

-a is equivalent to -rpd

So just use cp, cp -a, make sure the copies are the same, time and so on

--Cut or rename: mv

move

Note that there are no options for cutting

--Common directory functions

[root@andy ~]# cd /
[root@andy /]# ls
bin boot cgroup dev etc home lib lost found media misc mnt net opt ​​proc root sbin selinux srv sys tmp usr var

Switch to the root directory first/

These are first-level directories

bin and sbin, as well as bin and sbin under usr, are all system saving commands

/boot startup directory, saves the user’s startup data

/dev special file storage directory, do not touch it

/etc The default configuration file of the system, which will be changed frequently in the future

/home is the home directory of ordinary users, /root is the home directory of super users

/lib function library warehouse

misc media mnt empty directory, used for mounting, for connecting to other devices, you can set it yourself

proc sys cannot be operated directly, it is the drive letter of the memory

/tmp temporary directory

/usr system resource directory

/var saves the system variable document directory

In short, just put whatever you want in the home directory and /tmp

---Link command: ln

link

ln -s [source file] [destination file]

-s soft soft link

Note: the fundamental purpose of creating a link is to act as a daily shortcut

--hard link

Basically, it can be understood as different access points/names for the same file (imagine the front and back doors of the same classroom)

has the same i-node and storage block; if you delete one of them, you can still use

The disadvantage is that it cannot span partitions and cannot target directories

[root@andy ~]# ln /root/anaconda-ks.cfg /tmp/ana.hard
[root@andy ~]# ll
Total usage 48
-rw--- ----. 2 root root 1272 November 25 03:55 anaconda-ks.cfg
-rw-r--r--. 1 root root 26420 November 25 03:55 install.log
- rw-r--r--. 1 root root 7572 November 25 03:52 install.log.syslog
drwxr-xr-x. 3 root root 4096 November 26 04:55 japan
[root@ andy ~]# ll /tmp
Total usage 92
-rw-------. 1 root root 1272 November 26 04:55 ana
-rw-------. 2 root root 1272 November 25 03:55 ana.hard
drwxr-xr-x. 3 root root 4096 November 26 04:56 japan
-rw-------. 1 root root 81920 November 26 04:40 whatis.2kxNR9
-rw-------. 1 root root 0 November 25 03:32 yum.log

It’s basically invisible, except for the reference count of 1; but you can see the i-node number

[root@andy ~]# ls -li
Total usage 48
135177 -rw-------. 2 root root 1273 November 26 05:32 anaconda-ks.cfg
130564 -rw-r--r--. 1 root root 26420 November 25 03:55 install.log
130565 -rw-r--r--. 1 root root 7572 November 25 03:52 install .log.syslog
135180 drwxr-xr-x. 3 root root 4096 November 26 04:55 japan
[root@andy ~]# ls -li /tmp
Total usage 92
550003 -rw-------. 1 root root 1272 November 26 04:55 ana
135177 -rw-------. 2 root root 1273 November 26 05:32 ana.hard
550005 drwxr-xr-x. 3 root root 4096 November 26 04:56 japan
550004 -rw-------. 1 root root 81920 November 26 04:40 whatis.2kxNR9
522243 -rw-------. 1 root root 0 November 25 03:32 yum.log
If a file is deleted, the reference count will change back to 1

However, it is not recommended to create hard links: many restrictions; relatively hidden, only i nodes - soft links are recommended~

--soft link

Equivalent to windows shortcut

It has its own i-node and block, but the data block only stores the file name and i-node number of the source file, and there is no actual file data (similar to a treasure map stored)

The permissions of soft links are all lrwxrwxrwx

Delete the source file and the soft link will become invalid (it is said to be a shortcut)

Modify one and the other will also change

[root@andy ~]# cp -a anaconda-ks.cfg /root/japan
[root@andy ~]# ln -s /root/japan/anaconda-ks.cfg /tmp/an. soft
[root@andy ~]# ll
Total usage 48
-rw-------. 2 root root 1273 November 26 05:32 anaconda-ks.cfg
- rw-r--r--. 1 root root 26420 November 25 03:55 install.log
-rw-r--r--. 1 root root 7572 November 25 03:52 install.log.syslog
drwxr-xr-x. 3 root root 4096 November 26 05:43 japan
[root@andy ~]# ll /tmp
Total usage 92
-rw------ -. 1 root root 1272 November 26 04:55 ana
-rw-------. 2 root root 1273 November 26 05:32 ana.hard
lrwxrwxrwx. 1 root root 27 November 26 05:44 an.soft -> /root/japan/anaconda-ks.cfg
drwxr-xr-x. 3 root root 4096 November 26 04:56 japan
-rw----- --. 1 root root 81920 November 26 04:40 whatis.2kxNR9
-rw-------. 1 root root 0 November 25 03:32 yum.log
[root@andy ~ ]# ll -i /tmp
Total usage 92
550003 -rw-------. 1 root root 1272 November 26 04:55 ana
135177 -rw------. -. 2 root root 1273 November 26 05:32 ana.hard
533111 lrwxrwxrwx. 1 root root 27 November 26 05:44 an.soft -> /root/japan/anaconda-ks.cfg
550005 drwxr-xr-x. 3 root root 4096 November 26 04:56 japan
550004 -rw-------. 1 root root 81920 November 26 04:40 whatis.2kxNR9
522243 - rw-------. 1 root root 0 November 25 03:32 yum.log
[root@andy ~]# ll -i
Total usage 48
135177 -rw--- ----. 2 root root 1273 November 26 05:32 anaconda-ks.cfg
130564 -rw-r--r--. 1 root root 26420 November 25 03:55 install.log
130565 -rw-r--r--. 1 root root 7572 November 25 03:52 install.log.syslog
135180 drwxr-xr-x. 3 root root 4096 November 26 05:43 japan

Note a few points, i node, permissions, file name

In addition, in soft links, the source file must have an absolute path, otherwise an error may be reported

I wrote few examples myself, everyone should practice more

See you tomorrow

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1074840.htmlTechArticleBought the wrong movie ticket, had to watch it with tears -LAMP builds Linux foundation, movie ticket-lamp hi No As I said, my roommate treated me to a birthday party last Friday. I had a good time eating and drinking at Longhu, and we talked about it on the way back...
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

What should I do if the Ubuntu terminal cannot be opened? How to fix the problem that Ubuntu cannot open the terminal What should I do if the Ubuntu terminal cannot be opened? How to fix the problem that Ubuntu cannot open the terminal Feb 29, 2024 pm 05:30 PM

It is a very common problem these days that Ubuntu does not allow its users to open the terminal. If you receive a similar issue and don’t know what to do next, learn about five fixes on how to resolve this “Ubuntu cannot open terminal” issue on your Linux device. Without further ado, let’s dive into what causes it and the solutions available to it. Why can't Ubuntu open the terminal on it? This mainly happens when you install some defective software or modify the terminal configuration. In addition to this, new applications or games that interact with locales and corrupt them can cause similar problems. Some users reported a fix for this issue when searching for Terminal in Ubuntu's activity menu. This shows that

How to cancel the lock icon in the lower right corner of the Ubuntu 18.04 folder? How to cancel the lock icon in the lower right corner of the Ubuntu 18.04 folder? Jan 12, 2024 pm 11:18 PM

In the Ubuntu system, we often encounter folders with a lock shape on the top. This file often cannot be edited or moved. This is because there is no permission to edit the file, so we need to modify its permissions. How to remove the lock in the lower right corner? Let’s take a look at the detailed tutorial below. 1. Right-click on the locked folder--Properties. 2. Select the permissions option in the window. 3. Select everything inside to create and delete files. 4. Then select Change the permissions of the included files at the bottom, which are also set to create and delete files. Finally, remember to click Change in the upper right corner. 5. If the above lock is still not removed, or the options are grayed out and cannot be operated, you can right-click inside - open the terminal. 6. make

How to remove icons in Ubuntu start menu? How to remove icons in Ubuntu start menu? Jan 13, 2024 am 10:45 AM

There are many software icons listed in the Ubuntu system start menu. There are many uncommon icons. If you want to delete them, how should you delete them? Let’s take a look at the detailed tutorial below. 1. First enter the ubuntu desktop and click on the start menu under the left panel. 2. You can find a text editor icon inside, we need to delete it. 3. Now we return to the desktop and right-click the mouse to open the terminal. 4. Use the command to open the application list directory. sudonautilus/usr/share/applicationssudonautilus~/.local/share/applications5. Find the corresponding text editor icon inside. 6. Then go straight

Log in to Ubuntu as superuser Log in to Ubuntu as superuser Mar 20, 2024 am 10:55 AM

In Ubuntu systems, the root user is usually disabled. To activate the root user, you can use the passwd command to set a password and then use the su- command to log in as root. The root user is a user with unrestricted system administrative rights. He has permissions to access and modify files, user management, software installation and removal, and system configuration changes. There are obvious differences between the root user and ordinary users. The root user has the highest authority and broader control rights in the system. The root user can execute important system commands and edit system files, which ordinary users cannot do. In this guide, I'll explore the Ubuntu root user, how to log in as root, and how it differs from a normal user. Notice

A sneak peek of the seven highlights of Ubuntu 24.04 LTS A sneak peek of the seven highlights of Ubuntu 24.04 LTS Feb 27, 2024 am 11:22 AM

Ubuntu24.04LTS, codenamed "NobleNumbat" will be released soon! If you are using a non-LTS version such as Ubuntu 23.10, sooner or later you will need to consider upgrading. For those using Ubuntu20.04LTS or Ubuntu22.04LTS, it is worth thinking about whether to upgrade. Canonical has announced that Ubuntu 24.04LTS will provide update support for up to 12 years, broken down as follows: As an LTS version, it will have 5 years of regular maintenance and security updates. If you subscribe to Ubuntu Pro, you can enjoy an additional 5 years of support. Currently, this additional support period has been extended to 7 years, which means you will get up to 12

Ubuntu 20.04 screen recording software OBS installation and uninstallation graphic tutorial Ubuntu 20.04 screen recording software OBS installation and uninstallation graphic tutorial Feb 29, 2024 pm 04:01 PM

OBS is open source software developed by volunteer contributors around the world in their free time. A video live recording software, mainly used for video recording and live streaming. Please note that when installing Ubuntu/Mint, OBSStudio cannot fully work on ChromeOS, and functions such as screen and window capture cannot be used. It is recommended to use xserver-xorg1.18.4 or newer version to avoid potential performance issues with certain features in OBS, such as full-screen projectors. FFmpeg is required. If you don't have FFmpeg installed (if you're not sure, you probably don't), you can get it with: sudoaptinstallffmpeg I already have it installed here

Ubuntu finally supports disabling automatic updates of snap packages Ubuntu finally supports disabling automatic updates of snap packages Jan 13, 2024 am 10:09 AM

snap is a software packaging and deployment system developed by Canonical for operating systems that use the Linux kernel and systemdinit system. These packages, known as snaps, and the tool that uses them, snapd, are available across a range of Linux distributions and allow upstream software developers to publish their applications directly to users. With snap, users can easily install Linux applications. By default, snapd will check for updates four times a day and automatically update snap applications to the latest version. While there are many ways to control when and how often updates are installed, users cannot completely turn off automatic updates for security reasons. Although the original intention of snap is good, many people use it to

How to install Angular on Ubuntu 24.04 How to install Angular on Ubuntu 24.04 Mar 23, 2024 pm 12:20 PM

Angular.js is a freely accessible JavaScript platform for creating dynamic applications. It allows you to express various aspects of your application quickly and clearly by extending the syntax of HTML as a template language. Angular.js provides a range of tools to help you write, update and test your code. Additionally, it provides many features such as routing and form management. This guide will discuss how to install Angular on Ubuntu24. First, you need to install Node.js. Node.js is a JavaScript running environment based on the ChromeV8 engine that allows you to run JavaScript code on the server side. To be in Ub

See all articles