热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

InstallLAMPServer(Apache,MySQLorMariaDB,PHP)OnUbunt_MySQL

InstallLAMPServer(Apache,MySQLorMariaDB,PHP)OnUbuntu14.0413.10
MariaDBApacheLAMP

LAMPis a combination of operating system and open-source software stack. The acronym LAMP is derived from first letters of Linux, Apache HTTP Server, MySQL or MariaDB database, and PHP/Perl/Python.

In this tutorial, let us install LAMP server onUbuntu 14.04 Serveredition. My testbox hostname and IP address areserver.unixmen.localand192.168.1.2/24respectively.

Install Apache

Apacheis an open-source multi-platform web server. It provides a full range of web server features including CGI, SSL and virtual domains.

To install Apache, enter the following command from your terminal:

sudo apt-get install apache2

Test Apache:

Open your web browser and navigate tohttp://localhost/orhttp://server-ip-address/.

Apache2 Ubuntu Default Page: It works - Mozilla Firefox_001

Install MySQL

MySQLis a relational database management system (RDBMS) that runs as a server providing multi-user access to a number of databases, though SQLite probably has more total embedded deployments

sudo apt-get install mysql-server mysql-client

During installation, you’ll be asked to setup the MySQL root user password. Enter the password and click Ok.

sk@server: ~_002

Re-enter the password.

sk@server: ~_003

Now, MySQL server has been installed.

You can verify the MySQL server status using command:

sudo service mysql status

Sample output:

mysql start/running, process 3470

Note:If you want to use MariaDB instead of MySQL, then follow these steps.

Install MariaDB

MariaDBis a drop in replacement for MySQL. It is a robust, scalable and reliable SQL server that comes rich set of enhancements.

First you have to remove existing MySQL packages if any. To completely uninstall MySQL along with its configuration files, enter the following command:

sudo apt-get purge mysql*

Run the following command to remove unwanted packages.

sudo apt-get autoremove

Now, addMariaDB repository. Run the following commands to add PPA. Hence, MariaDB 5.5 repository is not yet updated to 14.04, we can use the repository of Ubuntu 13.10 instead.

sudo apt-get install software-properties-commonsudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xcbcb082a1bb943dbsudo add-apt-repository 'deb http://ftp.yz.yamagata-u.ac.jp/pub/dbms/mariadb/repo/5.5/ubuntu saucy main'

Update the software sources list and install MariaDB using following commands:

sudo apt-get update sudo apt-get install mariadb-server mariadb-client

During installation you will be asked to set mysql‘root’user password.

sk@server: ~_004

Re-enter password:

sk@server: ~_005

Check if mariadb is running or not, using the following command:

sudo service mysql status

Sample output:

 * /usr/bin/mysqladminVer 9.0 Distrib 5.5.37-MariaDB, for debian-linux-gnu on i686Copyright (c) 2000, 2014, Oracle, Monty Program Ab and others.Server version5.5.37-MariaDB-1~saucy-logProtocol version10ConnectionLocalhost via UNIX socketUNIX socket/var/run/mysqld/mysqld.sockUptime:2 min 18 secThreads: 1Questions: 566Slow queries: 0Opens: 337Flush tables: 4Open tables: 24Queries per second avg: 4.101

Install PHP

PHP(recursive acronym for PHP: Hypertext Preprocessor) is a widely used open-source general purpose scripting language that is especially suited for web development and can be embedded into HTML.

Install PHP with following command:

sudo apt-get install php5 php5-mysql libapache2-mod-php5

Test PHP

Create a sample“testphp.php”file in Apache document root folder.

sudo nano /var/www/html/testphp.php

Add the following lines.

Restart apache2 service:

sudo service apache2 restart

Navigate tohttp://server-ip-address/testphp.php. It will display all the details about php such as version, build date and commands etc.

phpinfo() - Mozilla Firefox_006

If you want to install all php modules, enter the commandsudo apt-get install php*and restart the apache2 service. To verify the modules, open web browser and navigate tohttp://server-ip-address/testphp.php. You will able to see all installed php modules.

Manage MySQL Databases (Optional)

Install phpMyAdmin

phpMyAdminis a free open-source web interface tool used to manage your MySQL databases. It is available in the Official Debian repositories. So install it with command:

sudo apt-get install phpmyadmin

Select the Web server you use, in my case it is apache2.

sk@server: ~_007

Select Yes to configure database for phpmyadmin wjth dbconfig-common.

sk@server: ~_008

Enter password of the database’s administrative user.

sk@server: ~_009

Enter MySQL application password phpmyadmin.

sk@server: ~_010

Re-enter the password.

sk@server: ~_011

Success, phpMyAdmin installation has been completed now.

Access phpMyAdmin Web Console

Now you can access the phpmyadmin console by navigating tohttp://server-ip-address/phpmyadmin/from your browser.

Enter your MySQL username and password which you have given in previous steps. In my case its “root” and “ubuntu”.

phpMyAdmin - Mozilla Firefox_012

You will be redirected to PhpMyAdmin main web interface.

192.168.1.2 - localhost | phpMyAdmin 4.0.10deb1 - Mozilla Firefox_013

Now you can manage your MySQL databases from phpMyAdmin web interface.

That’s it. Your LAMP server is up and running now.

推荐阅读
  • 分享css中提升优先级属性!important的用法总结
    web前端|css教程css!importantweb前端-css教程本文分享css中提升优先级属性!important的用法总结微信门店展示源码,vscode如何管理站点,ubu ... [详细]
  • 本文介绍了在开发Android新闻App时,搭建本地服务器的步骤。通过使用XAMPP软件,可以一键式搭建起开发环境,包括Apache、MySQL、PHP、PERL。在本地服务器上新建数据库和表,并设置相应的属性。最后,给出了创建new表的SQL语句。这个教程适合初学者参考。 ... [详细]
  • 本文介绍了在Web应用系统中,数据库性能是导致系统性能瓶颈最主要的原因之一,尤其是在大规模系统中,数据库集群已经成为必备的配置之一。文章详细介绍了主从数据库架构的好处和实验环境的搭建方法,包括主数据库的配置文件修改和设置需要同步的数据库等内容。MySQL的主从复制功能在国内外大型网站架构体系中被广泛采用,本文总结了作者在实际的Web项目中的实践经验。 ... [详细]
  • PHP组合工具以及开发所需的工具
    本文介绍了PHP开发中常用的组合工具和开发所需的工具。对于数据分析软件,包括Excel、hihidata、SPSS、SAS、MARLAB、Eview以及各种BI与报表工具等。同时还介绍了PHP开发所需的PHP MySQL Apache集成环境,包括推荐的AppServ等版本。 ... [详细]
  • PHP函数实现分页含文本分页和数字分页【PHP】
    后端开发|php教程PHP,分页后端开发-php教程最近,在项目中要用到分页。分页功能是经常使用的一个功能,所以,对其以函数形式进行了封装。影视网源码带充值系统,vscode配置根 ... [详细]
  • mysql引擎总结_Mysql架构组成之存储引擎总结
    1.Connectors的意思是不同语言中与sql的交互,在第一行其中有大家最熟知的php、python、perl等。2.Manageme ... [详细]
  • 如何实现织梦DedeCms全站伪静态
    本文介绍了如何通过修改织梦DedeCms源代码来实现全站伪静态,以提高管理和SEO效果。全站伪静态可以避免重复URL的问题,同时通过使用mod_rewrite伪静态模块和.htaccess正则表达式,可以更好地适应搜索引擎的需求。文章还提到了一些相关的技术和工具,如Ubuntu、qt编程、tomcat端口、爬虫、php request根目录等。 ... [详细]
  • 在说Hibernate映射前,我们先来了解下对象关系映射ORM。ORM的实现思想就是将关系数据库中表的数据映射成对象,以对象的形式展现。这样开发人员就可以把对数据库的操作转化为对 ... [详细]
  • 本文由编程笔记小编整理,介绍了PHP中的MySQL函数库及其常用函数,包括mysql_connect、mysql_error、mysql_select_db、mysql_query、mysql_affected_row、mysql_close等。希望对读者有一定的参考价值。 ... [详细]
  • ubuntu用sqoop将数据从hive导入mysql时,命令: ... [详细]
  • 如何在php中将mysql查询结果赋值给变量
    本文介绍了在php中将mysql查询结果赋值给变量的方法,包括从mysql表中查询count(学号)并赋值给一个变量,以及如何将sql中查询单条结果赋值给php页面的一个变量。同时还讨论了php调用mysql查询结果到变量的方法,并提供了示例代码。 ... [详细]
  • 腾讯安全平台部招聘安全工程师和数据分析工程师
    腾讯安全平台部正在招聘安全工程师和数据分析工程师。安全工程师负责安全问题和安全事件的跟踪和分析,提供安全测试技术支持;数据分析工程师负责安全产品相关系统数据统计和分析挖掘,通过用户行为数据建模为业务决策提供参考。招聘要求包括熟悉渗透测试和常见安全工具原理,精通Web漏洞,熟练使用多门编程语言等。有相关工作经验和在安全站点发表作品的候选人优先考虑。 ... [详细]
  • Linux下部署Symfoy2对app/cache和app/logs目录的权限设置,symfoy2logs
    php教程|php手册xml文件php教程-php手册Linux下部署Symfoy2对appcache和applogs目录的权限设置,symfoy2logs黑色记事本源码,vsco ... [详细]
  • MySQL5.6.40在CentOS764下安装过程 ... [详细]
  • 下载地址http:www.kbengine.org这货不错安装在Linux上安装(CentosDebianUbuntuetc.)服务端,请在终端输入:pythonkbenginek ... [详细]
author-avatar
筱冬瀦
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有