How to Build Your Own Server Under Ubuntu?

Source: Internet
Author: User
Keywords ubuntu server build your own cloud server ubuntu build your own ubuntu server
Recently, I really want to learn how to build a server under Linux. Everyone knows that the server is basically the world of Linux, and other systems are rarely used. In order to follow the trend, I also built a web server on my own server. Haha, let’s learn together. !

1. Install apache
My system is ubuntu and connected to the Internet, so it is very convenient to install the software, just execute the following command

sudo apt-get install apche2 apche2-doc
After the installation is complete, let's test it. If you have installed apache locally, then directly visit the browser: localhost. I installed it on the server here, so what I entered is the ip address of the server. Then the following screen appears in the browser and apache2 works normally:
img
2. Install mysql
Enter the command directly:

sudo apt-get install mysql-server mysql-client
When installing mysql, it will remind to set the root account password

3. Install php
sudo apt-get install php7.0 libapache2-mod-php7.0
Note: libapache2-mod-php7.0 is to allow apache2 to support the PHP module. Currently, PHP has reached 7.0. If there is a newer version, you can try the new version.

After configuring these things, we need to restart apapche for the configuration to take effect:

sudo service apche2 restart
or
sudo /etc/init.d/apache2 restart

After doing the above work, let me instill some common sense to everyone:

The file root directory of the apache default website is under /var/www. There is an index.html under the html folder. The information recorded in the index.html is what we visited when we visited localhost and the browser displayed things. We can replace the contents with ourselves favorite things.

Now we can write our webpage, and after writing the webpage, we can visit our website, hahaha.

For example, I created a php file in /var/www/html/, named my.php, and my php content is as follows:

<?
phpinfo();
?>
Then I input: localhost/my.php in the browser, (I operate on the server, so I input my ip address) and the following screen appears:

img
4. Get mysql support
If you want to use a database, then PHP must support your database. I use mysql here. We can install the php-mysql package. First, you can find the corresponding packages that need to be installed:

sudo apt-cache search php7.0

5. Install phpMyAdmin
phpMyAdmin is a network interface through which you can manage your mysql database. carried out

sudo apt-get install phpmyadmin
So far, a web server is set up! If there are errors in the above, please come to me to correct them!
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.