目次
Install Apache
Test Apache:
Install MySQL
Install MariaDB
Install PHP
Manage MySQL Databases (Optional)
Install phpMyAdmin
Access phpMyAdmin Web Console
ホームページ データベース mysql チュートリアル Install LAMP Server (Apache, MySQL or MariaDB, PHP) On Ubunt_MySQL

Install LAMP Server (Apache, MySQL or MariaDB, PHP) On Ubunt_MySQL

Jun 01, 2016 pm 01:16 PM

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.

<?phpphpinfo ();?>
ログイン後にコピー

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.

このウェブサイトの声明
この記事の内容はネチズンが自主的に寄稿したものであり、著作権は原著者に帰属します。このサイトは、それに相当する法的責任を負いません。盗作または侵害の疑いのあるコンテンツを見つけた場合は、admin@php.cn までご連絡ください。

ホットAIツール

Undresser.AI Undress

Undresser.AI Undress

リアルなヌード写真を作成する AI 搭載アプリ

AI Clothes Remover

AI Clothes Remover

写真から衣服を削除するオンライン AI ツール。

Undress AI Tool

Undress AI Tool

脱衣画像を無料で

Clothoff.io

Clothoff.io

AI衣類リムーバー

AI Hentai Generator

AI Hentai Generator

AIヘンタイを無料で生成します。

ホットツール

メモ帳++7.3.1

メモ帳++7.3.1

使いやすく無料のコードエディター

SublimeText3 中国語版

SublimeText3 中国語版

中国語版、とても使いやすい

ゼンドスタジオ 13.0.1

ゼンドスタジオ 13.0.1

強力な PHP 統合開発環境

ドリームウィーバー CS6

ドリームウィーバー CS6

ビジュアル Web 開発ツール

SublimeText3 Mac版

SublimeText3 Mac版

神レベルのコード編集ソフト(SublimeText3)

DockerでのMySQLメモリの使用を減らします DockerでのMySQLメモリの使用を減らします Mar 04, 2025 pm 03:52 PM

この記事では、DockerのMySQLメモリ使用量を最適化することを調査します。 監視手法(Docker統計、パフォーマンススキーマ、外部ツール)および構成戦略について説明します。 これらには、Dockerメモリの制限、スワッピング、およびcgroupsが含まれます

mysqlの問題を解決する方法共有ライブラリを開くことができません mysqlの問題を解決する方法共有ライブラリを開くことができません Mar 04, 2025 pm 04:01 PM

この記事では、MySQLの「共有ライブラリを開くことができない」エラーについて説明します。 この問題は、必要な共有ライブラリ(.so/.dllファイル)を見つけることができないMySQLの障害に起因しています。ソリューションには、システムのパッケージMを介してライブラリのインストールを確認することが含まれます。

Alter Tableステートメントを使用してMySQLのテーブルをどのように変更しますか? Alter Tableステートメントを使用してMySQLのテーブルをどのように変更しますか? Mar 19, 2025 pm 03:51 PM

この記事では、MySQLのAlter Tableステートメントを使用して、列の追加/ドロップ、テーブル/列の名前の変更、列データ型の変更など、テーブルを変更することについて説明します。

Linuxでmysqlを実行します(phpmyAdminを使用してポッドマンコンテナを使用して/なし) Linuxでmysqlを実行します(phpmyAdminを使用してポッドマンコンテナを使用して/なし) Mar 04, 2025 pm 03:54 PM

この記事では、PHPMyAdminの有無にかかわらず、LinuxにMySQLを直接インストールするのとPodmanコンテナを使用します。 それは、各方法のインストール手順を詳述し、孤立、携帯性、再現性におけるポッドマンの利点を強調しますが、

sqliteとは何ですか?包括的な概要 sqliteとは何ですか?包括的な概要 Mar 04, 2025 pm 03:55 PM

この記事では、自己完結型のサーバーレスリレーショナルデータベースであるSQLiteの包括的な概要を説明します。 SQLiteの利点(シンプルさ、移植性、使いやすさ)と短所(同時性の制限、スケーラビリティの課題)を詳しく説明しています。 c

MACOSで複数のMySQLバージョンを実行する:ステップバイステップガイド MACOSで複数のMySQLバージョンを実行する:ステップバイステップガイド Mar 04, 2025 pm 03:49 PM

このガイドは、HomeBrewを使用してMacOSに複数のMySQLバージョンをインストールおよび管理することを示しています。 Homebrewを使用して設置を分離し、紛争を防ぐことを強調しています。 この記事では、インストール、開始/停止サービス、および最高のPRAを詳述しています

MySQL接続用のSSL/TLS暗号化を構成するにはどうすればよいですか? MySQL接続用のSSL/TLS暗号化を構成するにはどうすればよいですか? Mar 18, 2025 pm 12:01 PM

記事では、証明書の生成と検証を含むMySQL用のSSL/TLS暗号化の構成について説明します。主な問題は、セルフ署名証明書のセキュリティへの影響を使用することです。[文字カウント:159]

人気のあるMySQL GUIツール(MySQL Workbench、PhpMyAdminなど)は何ですか? 人気のあるMySQL GUIツール(MySQL Workbench、PhpMyAdminなど)は何ですか? Mar 21, 2025 pm 06:28 PM

記事では、MySQLワークベンチやPHPMyAdminなどの人気のあるMySQL GUIツールについて説明し、初心者と上級ユーザーの機能と適合性を比較します。[159文字]

See all articles