Home  >  Article  >  Operation and Maintenance  >  Operating system--detailed introduction to Linux

Operating system--detailed introduction to Linux

PHP中文网
PHP中文网Original
2017-06-21 10:51:151777browse

1 Overview

1. What is an operating system?

The operating system is the intermediary between humans and computer hardware. The user cannot directly interact with the computer hardware and direct the computer to work, so an intermediary is needed. This intermediary is the operating system. The user issues commands to the operating system, and the operating system directly calls the hardware to work.

2.What is Linux?

Like the Windows operating system, Linux is also an operating system. At present, most web servers use Linux, which is why java programmers are familiar with it.

Linux operating system s reason.

2 Virtual Machine

1. What is a virtual machine?

A computer with real computer logic factors that is built using software simulation on a physical computer. Since the computer has no independent physical structure,

is called virtual machine.

2. The value of virtual machines

You can create multiple logical computers on a physical computer, that is, virtual machines, each The virtual machines are independent of each other, thus using one physical computer to create

situations of multiple computers to build an environment for multi-machine testing.

Three common operations

1. Auxiliary general operations

  • ctrl+alt: Make the mouse arrow exit the Linux operating system and enter the Window operating system.

  • ifconfig: View ip.

  • clear: Clear the screen.

  • cd ~: Return to the working directory.

  • # cd directory: Enter the specified directory.

  • cd ..: Return to the upper directory.

  • pwd: View current location.

2. File creation and deletion

  • touch filename: Create in the current directory document.

  • mkdir dir: Create a folder in the current directory.

  • rm -rf filename: Delete the file or folder with the specified name in the current directory.

  • rmdir dir: Delete empty folders.

3. File query

  • ls: View all visible files under the current path with folders.

  • ls -l: View detailed information about all visible files and folders in the current directory.

  • ls -a: View all files and folders in the current directory, including hidden folders and files.

  • ls -al: View detailed information about all files and folders in the current directory, including hidden folders and files.

4. Copy cut rename

  • cp oldfile dir: copy the file to the specified folder.

  • mv oldfile dir: Cut the file to the specified folder.

  • mv oldname newname: Rename the file.

5. Modify file permissions

Linux divides file visitors into three categories: file creators, Members of the same group as the file's creator, and members of a different group than the file's creator. Different visitors

have different permissions.

Permission representation:

  • r: read, read.

  • w: write, write.

  • # x: execute, execute.

# In order to facilitate the modification of permissions, Linux assigns an integer value to each permission. The integer value corresponding to r is 4, the corresponding integer value to w is 2, x The corresponding value is 1. When modifying the permission

, letters are no longer used, but the sum of the three permission values ​​is used, such as rwx. The corresponding number is 4+2+1=7, which corresponds to 7.

Use ls -l or ls -al to obtain file details, as follows:

drwxr-xr-x 2 root root 4096 06-20 18:42 abc
-rw-r--r-- 1 root root 0 06-20 18:41 content.txt
-rw-r--r-- 1 root root 124 06-20 18:39 hello.java

It starts with d and represents a folder. The beginning of "-" indicates a file.
Each visitor's permissions are composed of three parts: read, write, and execute. If a certain permission does not exist, the permission is occupied by -.

"rw-r--r--" indicates permissions, which are creator permissions, group member permissions, and non-group member permissions.

Modify permissions:

chmode 755 file: Set permissions for the creator, group members, and non-group members in sequence according to the permission value.

6. File editing

Use vi editor for file editing. The vi editor has two states: command state and editing state. After using the vi editor to open the file, you are in the command state. At this time, click i to enter the editing state. In the editing state, click esc to exit the editing state and enter the command state, where you can enter content into the file.

  • vi file: Use vi editor to open the file.

  • d+b: In the command state, press d, then b, to delete the current line.

  • esc: Exit the editing state.

  • :wq: Save and exit.

  • :q!: Do not save the modified content and force exit.

  • more file: View file content, not editable.

Four file transfer

Transfer files on the local Windows operating system to the remote Linux operating system. Use the tool WinSCP. The left side shows the local operating system and the right shows Linux. To transfer files, just drag the files from one side to the other.

Generally, the installation software is placed under the /usr/local/src file in the Linux operating system, and the software is installed in the /usr/local directory.

5 Remote Operation

To control the remote Linux server on the local Windows operating system, use the tool putty.

Six JDK installation

The Linux system has JDK installed by default, and the version is lower. You need to use the following command to download:

yum -y remove java-1.4.2-gcj-compat-1.4.2.0-40jpp.115

After uninstalling, use java -version to check whether the uninstallation is complete.

Enter the jdk installation file directory and enter "./JDK installation file" to complete the installation. After the installation is complete, you need to configure the environment variables in the /etc/profile file . Use the vi editor to add the following content at the end of the profile file:

###############################JAVA_ENV################################
JAVA_HOME=/usr/local/jdk6
PATH=$PATH:$JAVA_HOME/bin
export JAVA_HOME PATH

Among them, $PATH refers to the system environment variable. When configuring environment variables in Linux, separate two adjacent paths with ":" and add "$" in front to reference the environment variable.
After the configuration is completed, save it, enter the source profile name, rewrite the imported profile file, and the environment becomes zero and the configuration is completed.

Seven Tomcat Installation

Unzip the tomcat installation file, configure environment variables, and add:

# at the end of the profile file ##
###############################JAVA_ENV################################
JAVA_HOME=/usr/local/jdk6
PATH=$PATH:$JAVA_HOME/bin
export JAVA_HOME PATH

After saving, execute source profile to re-import the profile file, and the environment variables are configured.

  • startup.sh: Start the tomcat server.

  • shutdown.sh: Shut down the tomcat server.

Eight MySQL installation

Unzip the MySQL installation file and execute MySQL separately using the "rpm -ivh file name" format -client-5.6.16-1.rhel5.i386.rpm/MySQL-devel-5.6.16-1.rhel5.i386.rpm /MySQL-server-5.6.16-1.rhel5.i386 .rpm three executable files.

service mysql start/stop/restart: Open/stop/restart the MySQL server.

Create user:

service mysql stop
mysqld_safe --skip-grant-tables &
mysql -uroot -p
use mysql
update user set password=PASSWORD("123")where user="root";
flush privileges;
quit;
service mysql restart
mysql -uroot -p新密码
set password=PASSWORD("123");

First enter through the security mechanism, and then store the user name and password in the user table middle.

The above is the detailed content of Operating system--detailed introduction to Linux. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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