3. About the src source code file package
The source code of Linux software src refers to the release form of all program source codes of the software, which requires the user to compile it into executable binary code bins and install it. Its advantage is that it is flexible configuration, and some functions/modules can be removed or retained at will, and it can be adapted to a variety of hardware/operating system platforms and compilation environments. The disadvantage is that it is difficult and is generally not suitable for beginners.
How do you know if a /bz2 package is a binary file package or a source code package? The best way to tell what it is is to check the file list in the package, use the command tar ztvf *. After decompressing and unpacking, enter the newly generated directory.
Files in the source code package often contain various source code files, header file *.h, c code source file *.c, C++ code source file *.cc/*.cpp, etc.; while files in the binary package will have executable files (the same name as the software is often the main execution file), which is marked that the path in which it is located contains a directory named bin (with only a few exceptions).
If it is unpacked, it can be compiled in the newly generated directory. The method has been introduced before. Now let’s talk about installation and co-installation:
Installation: rpm-rebuild
cd /usr/src/redhat/RPMS/
rpm -ivh *.rpm
Uninstall: rpm-e xv
Description: rpm --rebuild *. The command compiles the source code and generates a binary rpm package under /usr/src/redhat/RPMS, and then installs the binary package.
3. Change of file permissions
chmod ---------Some common sense about getting started
Author: wangbin Posted on: 2003-09-13 23:49:13
Instruction name: chmod
Usage permissions: All users
How to use chmod [-cfvR] [--help] [--version] mode file...
Note: The file access permissions of Linux/Unix are divided into three levels: file owner, group, and others. Use chmod to control how files are stored and accessed by others.
Plan:
mode : The permission setting string, the format is as follows: [ugoa...][[+-=][rwxX]...][,...], where u represents the owner of the file, g represents the same group as the owner of the file, o represents people other than others, and a represents all three.
+ means adding permissions, - means canceling permissions, = means setting permissions.
r means readable, w means writeable, x means executable, X means executable only if the file is a subdirectory or the file has been set to executable.
-c : If the file permissions have indeed changed, the change action will be displayed.
-f : If the file permissions cannot be changed, do not display error messages.
-v : Show detailed information about permission changes
-R : Make the same permission changes to all files in the current directory and subdirectories (that is, change them one by one in a relay manner)
--help : Display auxiliary instructions
--version : Show version
Example: Set the file to be readable by everyone:
chmod ugo+r
Set the file to be readable by everyone:
chmod a+r
Set the file and the file owner, and those who belong to the same group can write it, but those who are other than those who belong to cannot write it:
chmod ug+w,o-w
Set to only the owner of this file can execute:
chmod u+x
Set all files and subdirectories in the current directory to be readable by anyone:
chmod -R a+r *
In addition, chmod can also be used to represent permissions such as chmod 777 file
The syntax is: chmod abc file
where a, b, and c are each a number, representing the permissions of User, Group, and Other respectively.
r=4,w=2,x=1
If you want rwx attribute, 4+2+1=7;
If you want rw-attribute, 4+2=6;
If you want the r-x attribute, 4+1=7.
Example:
chmod a=rwx file
and
chmod 777 file
The effect is the same
chmod ug=rwx,o=x file
and
chmod 771 file
The effect is the same
If you use chmod 4755 filename, this program can have root permissions
Instruction name: chown
Usage permissions: root
How to use chmod [-cfhvR] [--help] [-version] user[:group] file...
Note: Linux/Unix is a multi-person and multi-working system, and all files have owners. Use chown to change the owner of the file. Generally speaking, this instruction is only used by the system administrator (root). Generally, users do not have permission to change other people's file owners, nor can they change their own file owners to others. Only the system administrator (root) has such permissions.
Plan:
user: The user of the new file owner IDgroup: The user group of the new file owner -c: If the file owner has indeed changed, the change action will be displayed -f: If the file owner cannot be changed, do not display error message -h: Only change the link, not the file that the link really points to -v: Show detailed information about the owner's change -R: Make the same owner changes for all files in the current directory as subdirectories (that is, change them one by one in a recurring manner)-help: Show auxiliary instructions-version: Show version
Example:
Set the owner of the file as the user group of users jessie:
chown jessie:users
Set all files and subdirectories in the current directory to users group users lamport:
chmod -R lamport:users *
-rw--------(600) -- Only the owner has read and write permissions.
-rw-r--r-- (644) - Only the owner has read and write permissions; while the group users and other users only have read permissions.
-rwx-------(700) -- Only the owner has read, write, and execute permissions.
-rwxr-xr-x (755) --The owner has read, write and execute permissions; while the group users and other users only have read and execute permissions.
-rwx--x--x (711) -- The owner has read, write and execute permissions; while the group users and other users only have execution permissions.
-rw-rw-rw- (666) - All users have file read and write permissions. This approach is not advisable.
-rwxrwxrwx(777) - All users have read, write and execute permissions. A more undesirable approach.
The following are two normal settings for the directory:
drwx------(700) - Only the owner can read and write in the directory.
drwxr-xr-x (755) - All users can read this directory, but only the owner can change the contents in the directory.
4. Commonly used linux commands
1. Enter the pure command line
Enter at the terminal
#/sbin/telinit 3
2. The root password is lost and solved
GRUB: On the boot loader menu, type [e] to enter editing mode.
You will face a list of bootstrap projects. Find sentence lines similar to the following output:
kernel /vmlinuz-2.4.18-0.4 ro root=/dev/hda2
Press the arrow keys until the line is highlighted, and then press [e].
You can now add a single space at the end of the text to tell GRUB to boot single user Linux mode. Press the [Enter] key to make the editing result take effect.
You will be taken to edit mode screen, from here, press After finishing loading, you will face a shell prompt similar to the following:
sh-2.05#
Now you can change the root command and type:
bash# passwd root
You will be asked to re-type the password to verify. After the end, the password will be changed, and you can type reboot at the prompt to reboot; then, log in as the root user as usual.
LILO: When the system starts to the LILO boot screen, press the TAB key for the graphics boot mode to enter the text mode, and then at LILO
Enter linux single to enter to enter the password-free console. After entering, use the passwd command to modify the root password.
Just do it.
5. MySQL database operation
Connect to the database server./mysql -h host_name -u user_name -p
* -h host_name(--host=host_name), the name of the connected database host, which can be omitted if it is on the local host.
*-u user_name(--user=user_name), database username. On a Unix system, if the system's login name is the same as the data username, it can be omitted. In Windows system, the database user name can be given by setting the environment variable USER, such as set USER=username.
* -p(--password), provides the database user password. With this option, mysql will prompt you to enter the password. The entered password is displayed in an asterisk for security. You can also write the password directly after -p (there cannot be spaces between -p and the password), but this is not safe and is not recommended.
After the connection is successful, the mysql database server will display some welcome messages. Then use the mysql>use database_name command to open the specified database. grant all on egroupware.* to root@localhost identified by 'oletolet';
Server startup and shutdown
The startup method of MySQL server on Linux and Windows platforms is very different. Here we will introduce it separately:
* Linux platform: Under the Linux platform, every process needs to be run by a user. It is best not to run MySQL as a root user. We can create a mysql user and mysql group. The MySQL server program directory and data directory are owned by this user and group, and other users do not have any permissions. Run the MySQL server as mysql user. % mysqld --user=mysql
#Even if the command is executed as root user, the MySQL database will still be associated with the mysql user ID. In order to make the server automatically run as mysql user when the system starts, the configuration file needs to be configured and user=mysql is included in the [mysqld] section.
Close the server to use % stop or % mysqladmin -u root -p shutdown
* Windows platform: Manual method: directly run the c:\mysqld command.
As a service method: run the c:\mysqld-nt --install command to install mysqld-nt as a Windows service. After that, whenever Windows starts, it will run automatically. mysqld-nt is a MySQL server that supports named pipes.
Run c:\mysqld-nt --remove to delete the service.
The method to manually start the shutdown service is to run the c:\net start mysql and c:\net stop mysql commands.
Under the windows platform:
Log in to the server with the administrator account and close the MySQL database server.
Start the server with the --skip-grant-tables parameter:
c:\mysql\bin>mysqld-nt --skip-grant-tables
Reopen a console window and use the mysql command to log in to the server to set the new password of root:
c:\mysql\bin>mysql
mysql> use mysql
mysql> set password for 'root'@'localhost' = password('password');
Uninstall rpm
Check whether to install
rpm-qa | grep package name
Uninstall rpm –e package name
Loading disc mount -t iso9660 /dev/hdc /mnt/cdrom