In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
Editor to share with you a case of CentOS using local yum sources to build a LAMP environment, I believe most people do not know much about it, so share this article for your reference. I hope you will learn a lot after reading this article. Let's learn about it together.
Configure firewall to open ports 80 and 3306
Vi / etc/sysconfig/iptables
As shown in the figure, add the following two items:
-An INPUT-m state-- state NEW-m tcp-p tcp-- dport 80-j ACCEPT # allow port 80 to pass through firewall-An INPUT-m state-- state NEW-m tcp-p tcp-- dport 3306-j ACCEPT # allow port 3306 to pass through firewall
Restart the firewall for the configuration to take effect
/ etc/init.d/iptables restart
Close SELINUX
Vi / etc/selinux/config#SELINUX=enforcing # comment out # SELINUXTYPE=targeted # comment out SELINUX=disabled # add: wq! # Save exit
Restart the system
Shutdown-r now
[install Apache]
Perform installation
Yum-y install httpd
Start Apache
Service httpd restart
Or:
/ etc/init.d/httpd start
After Apache starts, the error Could not reliably determine the server's fully qualifdomain name, using:: 1 for ServerName will be prompted. The solution:
Vi / etc/httpd/conf/httpd.conf
Find # ServerName www.example.com:80
Change to ServerName www.lws.com:80 (set to your own domain name or ServerName localhost:80)
: wqquit # Save exit
Set to boot
Chkconfig httpd on
Check the installation access host address as shown in the figure for successful installation
Modify Apache configuration
Vi / etc/httpd/conf/httpd.conf # it is recommended to use the ftp tool to make a backup before modification
The modifications are as follows:
ServerTokens OS # was modified on line 44 to: ServerTokens Prod (do not display the name of the server operating system when an error page occurs) ServerSignature On # changed to: ServerSignature Off (do not show the version of Apache in the error page) Options Indexes FollowSymLinks # changed to: Options Includes ExecCGI FollowSymLinks (allows the server to execute CGI and SSI Disable listing of directories) # AddHandler cgi-script .cgi # is modified to: AddHandler cgi-script .cgi .pl (allows CGI scripts with .pl extension to run) AllowOverride None # to: AllowOverride All (allow .htaccess) AddDefaultCharset UTF-8 # to: AddDefaultCharset GB2312 (add GB2312 as the default encoding) Options Indexes MultiViews FollowSymLinks # to Options MultiViews FollowSymLinks on line 554 (do not display the tree on the browser) DirectoryIndexindex.html index.html.var # is modified to: DirectoryIndexindex.html index.htm Default.html Default.htm index.php Default.phpindex.html.var (set the default home page file) at line 402 Add index.php) KeepAlive Off # modified to: KeepAlive On (allow programmatic online) MaxKeepAliveRequests100 # at line 83 to: MaxKeepAliveRequests1000 (increase the number of simultaneous connections)
Delete two default test pages
Rm-f / etc/httpd/conf.d/welcome.conf / var/www/error/noindex.html
Restart Apache
Service httpd restart
Or
/ etc/init.d/httpd restart
[install MySQL]
Perform installation
Yum-y install mysql mysql-server
Start MySQL
/ etc/init.d/mysqld start
Set to boot
Chkconfig mysqld on
Copy the configuration file (Note: if there is a my.cnf by default under the / etc directory, you can overwrite it directly)
Cp / usr/share/mysql/my-medium.cnf / etc/my.cnf
Set the password for the root account
Enter mysql_secure_installation#, enter Y according to the prompt, enter the password twice, enter Y all the way according to the prompt, and finally appear: Thanks for using MySQL setting is complete
Or
Mysqladmin-u root password 'password'
Allow remote login
Mysql-u root-p
Enter password
Enter the mysql command:
GRANT ALL PRIVILEGES ON *. * TO 'root'@'%' IDENTIFIED BY' password 'WITH GRANT OPTION
Exit mysql:exit
Restart MySQL
Service mysqld restart
[install PHP5]
Perform installation
Yum-y install php
Install the PHP component (select the following installation package here and enter Y to install according to the prompts)
The copy code is as follows:
Yum install php-mysql php-gd libjpeg* php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-mcrypt php-bcmath php-mhash libmcrypt
Modify PHP configuration
Vi / etc/php.ini # it is recommended to use the ftp tool to make a backup before modification
The modifications are as follows:
Date.timezone= PRC # remove the previous semicolon on line 946 and change it to date.timezone= PRC
The copy code is as follows:
Disable_functions = passthru,exec,system,chroot,scandir,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server,escapeshellcmd,dll,popen,disk_free_space,checkdnsrr,checkdnsrr,getservbyname,getservbyport,disk_total_space,posix_ctermid,posix_get_last_error,posix_getcwd,posix_getegid,posix_geteuid,posix_getgid,posix_getgrgid,posix_getgrnam,posix_getgroups,posix_getlogin Posix_getpgid,posix_getpgrp,posix_getpid,posix_getppid,posix_getpwnam,posix_getpwuid, posix_getrlimit,posix_getsid,posix_getuid,posix_isatty,posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid,posix_setpgid,posix_setsid,posix_setuid,posix_strerror,posix_times,posix_ttyname,posix_uname # lists the functions that PHP can disable at line 386 If some programs need to use this function, you can delete it and undisable it.
Expose_php = Off # disable the display of php version information on line 432 magic_quotes_gpc = On # Open magic_quotes_gpc on line 745to prevent SQL injection short_open_tag = On # support php short tag open_basedir =.: / tmp/# on line 380th means allowing access to the current directory (that is, the directory where the PHP script files are located) and / tmp/ directory, which can prevent php Trojans from crossing sites, if there is a problem with the installer after the change You can log out of this line, or write directly to the program's directory / data/www.osyunwei.com/:/tmp/
Restart MySQL, Apahe
Service mysqld restartservice httpd restart
(after completing the yum source to build the LAMP environment, we can check the installation version of each part.)
View Apache version
Httpd-v
View PHP version
Php-v
View MySQL version
Mysql-V
(pay attention to capitalization)
These are all the contents of the article "CentOS uses local yum sources to build a LAMP environment". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.