A simple guide to building a LAMP+VSFTPD environment on CentOS, centosvsftpd_php tutorial

Source: Internet
Author: User
Tags phpinfo ftp client vps filezilla ftp protocol web hosting

A simple guide to building a LAMP+VSFTPD environment on CentOS, CENTOSVSFTPD


VPS can be seen as a server that only you use (in fact it is a virtual machine), you can install any software on the above, with maximum permissions. The greater the so-called authority, the greater the responsibility, you need to install your own WEB server, database, PHP, and other maintenance work should be self-processing.

Most VPS now provide the operating system is Linux, and there is no graphical interface, only the SSH command line interface, so there will be some simple Linux command line. Linux also has a number of distributions, the best distribution may be Redhat, but it is commercial software, not free to use, but fortunately it also has a community version of CentOS, the full use of Redhat source code, remove Redhat LOGO, replace their own, In addition, some closed-source software is removed, so the system function, performance and stability is almost equivalent to Redhat, select it.
Install Linux

For Linux installation, you can choose the distribution you are familiar with, such as Ubuntu, Debian, Fedora, etc., the service chamber is installed by default in the minimized installation mode, I choose CentOS 6.3, considering the low VPS memory, the installation is 32-bit version.

Install it later to log in as root, and let the system make some necessary updates. Linux and Macs have their own Terminal, and if it's Windows, we recommend using PuTTY for SSH connections.

#以 root User Login server ssh root@198.xxx.xxx.xxx ... #系统更新yum update ...

Installing Apache

Apache is a free, open-source web server on a Linux platform, and it is said that more than half of the world's websites are running on Apache. To install Apache, enter the following command at the command line:

Yum Install httpd

The default installation of Apache may not be the latest version, but it is the most stable version tested on this Linux version, if you must install the latest version, you need to download the latest version from the Apache official website.

Once installed, execute the following command to start the Apache service:

Service httpd Start

The default Web hosting directory is located in/var/www/html/, then access http://198.xxx.xxx.xxx in the browser, if a test page of Apache can appear, then the Apache has been installed successfully.
Install MySQL

MySQL is a very popular database software, originally developed by the Swedish MySQL AB Company, after the acquisition by Sun, currently for the Oracle company products, installation of MySQL command as follows:

Yum Install Mysql-server

To start the MySQL service:

Service mysqld Start

Then you need to set a password for the root user of MySQL, you can enter the command:

/usr/bin/mysql_secure_installation

To execute the above command, MySQL will ask you to provide the root user's password now, because we have just installed, so the password is empty, enter directly, and then set the new root user password.

Then there will be some security options for you to choose Y or N. For example, whether to remove the anonymous login, whether to prevent the root user from remote login, if you choose Y, then root can only be logged in localhost, and whether to remove the test database, immediately refresh the permissions table, and so on, presumably the following:

[Root@centos6 ~]#/usr/bin/mysql_secure_installation
Note:running all PARTS of this SCRIPT are RECOMMENDED for all MySQL SERVERS in PRODUCTION use! Please READ each STEP carefully! In order to log into MySQL to secure it, we'll need the CurrentPassword for the root user. If you ' ve just installed MySQL, Andyou Haven ' t set the root password yet, the password would be is blank,so you should just PR ESS enter here. Enter current password to root (enter for none): OK, successfully used password, moving on ... Setting The root password ensures that nobody can log into the Mysqlroot user without the proper authorisation. Set root Password? [y/n] ynew password:re-enter new Password:password updated successfully! Reloading privilege tables. ... success! By default, a MySQL installation had an anonymous user, allowing Anyoneto logs into MySQL without had to had a user ACC Ount created Forthem. This was intended only for testing, and the Installationgo a bit smoother. You should remove them before moving into aproduction environment. Remove Anonymous users? [y/n] Y ... success! Normally, Root should only is allowed to connect from ' localhost '. Thisensures that someone cannot guess at the root of password from the network. Disallow Root login remotely? [y/n] Y ... success! By default, MySQL comes with a database named ' test ' that anyone canaccess. This was also intended only for testing, and should was removedbefore moving into a production environment. Remove test database and access to it? [y/n] y-dropping Test Database ... success! -Removing privileges on test database ... success! Reloading the privilege tables would ensure that all changes made so farwill take effect immediately. Reload privilege tables now? [y/n] Y ... success! Cleaning up ... All done! If you've completed all of the above steps, your mysqlinstallation should now is secure. Thanks for using mysql!

Install PHP

PHP is a widely used open source dynamic scripting language, to install PHP, and to work with MySQL, the following commands need to be executed:

Yum Install PHP Php-mysql

At this point, you need to test whether PHP works properly, you can build a test page.

#切换到 Apache Default Web page directory cd/var/www/html# create a php script file touch phpinfo.php# write a small snippet of PHP script to the file, test with Echo ' <?php phpinfo ();?> ' > phpinfo.php

# because PHP has just been installed, so don't forget to restart Apache, otherwise PHP will not work properly
Service httpd Restart

Then visit http://198.xxx.xxx.xxx/phpinfo.php in your browser to see if PHP is working properly.

If the page can properly display the server-related environment information, the LAMP environment is already working properly.
Installing VSFTPD

To securely upload files to the server, or download files from the server, the easiest way is to use FTP, here we choose Linux under the very popular "Very secure FTPD", that is, very secure ftp:

Yum Install vsftpd

Once installed, there are some simple configurations to make:

#编辑 vsftpd profile vi/etc/vsftpd/vsftpd.conf ... #不允许匿名登陆anonymous_enable =no# local account can login local_enable=yes# can write write_enable =yes# All users can only access their home directory Chroot_local_user=yes ... #重启 vsftpd above settings to take effect service VSFTPD restart

How to access the server with the FTP protocol, it is recommended to FileZilla this FTP client tool, with Windows version, Linux version and Mac OS version.

Login vsftpd generally log in with the Linux user area, but do not allow the root user to log in, so you need to create a new Linux User:

#添加用户 lichaoadduser lichao# Set the password for Lichao passwd lichao# If for security reasons, this user you only want it to login vsftpd, #而不能以 SSH login server, you can disable SSH login usermod- S/sbin/nologin Lichao

At this point, you can use any FTP tools such as FileZilla, to lichao this user and corresponding password to login vsftpd, the default directory is/home/lichao
Setting up Apache, MySQL, and vsftpd services boot up

The commands to set them on boot are as follows:

Chkconfig httpd onchkconfig mysqld onchkconfig vsftpd on

PHP will start with Apache.

At this point, a basic complete Dynamic Web server, database server, FTP server installation is complete.

http://www.bkjia.com/PHPjc/1041627.html www.bkjia.com true http://www.bkjia.com/PHPjc/1041627.html techarticle A simple guide to building a LAMP+VSFTPD environment on CentOS, centosvsftpd VPS can be seen as a server that only you use (in fact it's a virtual machine), you can ...

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.