Lamp Environment Build LINUX/SSH/FTP server

Source: Internet
Author: User
Tags php mysql

Lamp:linux + Apache +mysql+php attached: ssh/ftp server
1. Install Ubuntu ServerPlease refer to the official documentation Http://www.ubuntu.org.cn/download/server
2, modify the root account password "Su/sudo"
Open terminal input: sudo passwd root---Enter the current account password---Enter the new root password---Enter the new root password again
3. Installing the SSH Service
Open terminal input: sudo apt-get update------updating the software source sudo apt-get install openssh-server----Installing the SSH service automatically starts the SSH service when it is installed, the default port number: 22sudo/ Etc/init.d/ssh Start/restart
To modify the default port:
Method 1: Locate port 22 in the/etc/ssh/sshd_config file and modify it to < New port number >

Method 2: Use/usr/sbin/sshd-p < new port number > Specify port

The next steps can continue to operate directly on the server.
Also available through remote client access, it is recommended to use Xshell

4. Installing ApacheOpen Terminal input:
sudo apt-get install apache2

Check whether the installation was successful:
Apache2-v

Browser input: Http://loclhost or http://< server ip> can be properly accessed to prove the installation was successful.



5. Install PHPOpen Terminal input:
sudo apt-get install php5
Verify that the installation is successful:
Php5-v
Check if libphp5.so is loaded:
Cat/etc/apache2/mods-enabled/php5.load
Show:
LoadModule php5_module/usr/lib/apache2/modules/libphp5.so

Proof has been loaded
6. Install MySQLOpen Terminal input:
sudo apt-get install mysql-server  -----required to enter the root of MySQL (note separate from the system root account) password
Make sure that MySQL and PHP interact properly:
Cat/etc/php5/conf.d/mysq.ini
If displayed:
Cat:/etc/php5/conf.d/mysql.ini:no such file or directory
Proof that PHP's MySQL module is not installed.
To install the MySQL module for PHP:
sudo apt-get install Php5-mysql
Execute again:
Cat/etc/php5/conf.d/mysq.ini
Show:
Configuration for PHP MySQL moduleextension=mysql.so

* Restart MySQL for MySQL to run normally:
sudo service MySQL restart
* Restart Apache:
sudo service apache2 restart
7. Simplified installation step 4--6: Steps 4th through 6th can be installed directly from a single command:
sudo apt-get install apache2 php5 mysql-server php5-mysql

Dolly Mix

sudo tasksel install Lamp-server

If you purchased a Ayi server: You can also install it using the Ayi one-click installation script.

The default Apache web directory under/var/www/, to which the lamp environment has been built successfully.

Note:Detect if lamp is working properly, switch directory to/var/www/, build test.php file
cd/var/www/
sudo vi test.php
Input:
<?phpecho mysql_connect (' localhost ', ' root ', ' < 6th ' Enter the password > ')? Connection succeeded <a href= ' Http://blog.csdn.net/chenxiruanhai ' > Dawn soft Sea </a> ': ' Connection failed! '; Phpinfo ();? >
Save

Browser input: http://< server address >/test.php


8.FTP ServerOpen Terminal input:
sudo apt-get install vsftpd
After successful installation, the FTP group is established by default and can be accessed anonymously.
Verify success: Just access in browser: ftp://< server ip>
To Open, stop, and restart the VSFTPD service:
Service VSFTPD Start | Stop | Restart
The vsftpd you have just installed can be visited anonymously by defaultAskOf,If you only want to give a specific user access to a directory, you need to modify the configuration of the VSFTPD

I, create a user who is dedicated to access:
Mkdir-p/home/testsudo useradd test-g ftp-d/home/test-s/sbin/nologin
II, set the password:
sudo passwd test
III. Modify the VSFTPD configuration file "vi/etc/vsftpd.conf":
#禁止匿名访问anonymous_enable =no# Accept Local Users local_enable=yes# can upload write_enable=yes# enabled in Chroot_list_file users can only access the root directory chroot_ List_enable=yeschroot_list_file=/etc/vsftpd.chroot_list
Iv,in/etc/vsftpd.chroot_list Add users who are restricted by the Access directory:
SU----switch to Roottouch vsftpd.chroot_list  ------New Vsftpd.chroot_list file echo "test" >>/etc/vsftpd.chroot_list


Note:
"530 Login incorrect" :
Add "/sbin/nologin" to the last line of/etc/shells
"OOPS:vsftpd:refusing to run with writable root inside Chroot ()" :
chmod a-w/home/test
Restart VSFTPD:
Service VSFTPD Restart
You can then access it using the newly created account above.

Lamp Environment Build LINUX/SSH/FTP server

Related Article

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.