首页 | 资讯动态 | linux基础 | 系统管理 | 网络管理 | 编程开发 | linux数据库 | 服务器技术 | linux相关 | linux认证 | 嵌入式 | 下载中心 | 专题 | linux招聘 | 镜像站
OKLinux中文技术站
·设为首页
·加入收藏
·联系我们
系统管理: 中文环境 系统管理 桌面应用 内核技术 | Linux基础: 基础入门 安装配置 常用命令 经验技巧 软件应用 | Linux数据库: Mysql Postgre Oracle DB2 Sybase other
网络管理: 网络安全 网络应用 Linux服务器 环境配置 黑客安全 | 编程开发: PHP CC++ Python Perl Shell 嵌入式开发 java jsp | PHP技术: PHP基础 PHP技巧 PHP应用 PHP文摘
Linux资讯 Linux招聘 Linux专题 Apache | Linux相关: 硬件相关 Linux解决方案 Linux认证 企业应用 其它Unix | 相关下载: 资料下载 参考手册 开发工具 服务器类 软路由 其它
 技术搜索:
会员中心 注册会员 高级搜索  
  → 当前位置:首页>网络管理>网络应用>正文

Ubuntu下构建LAMP服务器

http://www.oklinux.cn  2007-01-05  来源: linux.chinaunix.net olddocks  会员收藏  游客收藏  【 】 

Build Your Own Debian/Ubuntu LAMP Server - Quick & Easy Do it Yourself Installation

  • Apache 2 - Linux Web server
  • MySQL 5 - MySQL Database Server
  • PHP4/5 - PHP Scripting Language
  • phpMyAdmin - Web-based database admin software.

Note: Linux + Apache + MySQL + PHP/Perl together commonly known as LAMP Server.

First, let us prepare a system that has a minimum requirement of Debian/Ubuntu version of linux with atleast 256MB of RAM available. Anything less than this minimum ram will cause lot of problems since we are running a server along especially mysql and webmin requires lot of RAM to run properly. Mysql will give you this nasty error "cannot connect to mysql.sock" if you dont have enough memory in your server.

I love debian/ubuntu based linux because of my enormous affinity towards this command apt-get. As a starter knowing this one command, It is so easy to install packages and you dont need to worry about package dependency and configuration. You need to buy a dedicated server or a VPS package if you want to setup your own server. If you want to experiment with the server and installation it is recommended to buy a vps package from various hosts. I prefer vpslink because of their pricing. Believe it or not it is so easy to install and configure your server yourself eventhough you are new are to linux and dedicated/vps hosting.

First download PuTTy if you are accessing your server through SSH. Just enter the IP of your server with root login to access your host. As you probably know, Webmin is a freely available server control panel and we will setup this once we have completed the LAMP server and Mail Server. Webmin makes more easier for us to fine tune our linux box.

Before proceeding to install, update the necessary packages with debian with this command.

apt-get install update

 

1. Installing Apache + PHP

Apache is one of the most famous web server which runs on most linux based servers. With just few commands you can configure apache to run with PHP 4 or PHP 5.

If you want to install PHP 4, just apt-get

apt-get install apache2 php4 libapache2-mod-php4

To install PHP5, just run the following on linux shell. Note that if you dont specify packages with '4', PHP5 will be automatically installed.

apt-get install apache2 php5 libapache2-mod-php5

Apache configuration file is located at: /etc/apache2/apache2.conf and your web folder is /var/www.

To check whether php is installed and running properly, just create a test.php in your /var/www folder with phpinfo() function exactly as shown below.

nano /var/www/test.php

# test.php

<?php phpinfo(); ?>

Point your browser to http://ip.address/test.php or http://domain/test.php and this should show all your php configuration and default settings.

You can edit necessary values or setup virtual domains using apache configuration file.

 

2. Installing MySQL Database Server

Installing mysql database server is always necessary if you are running a database driven ecommerce site. Remember running mysql server to a fair extend requires atleast 256mb of RAM in your server. So unless you are running database driven sites you dont absolutely need mysql. The following commands will install mysql 5 server and mysql 5 client.

apt-get install mysql-server mysql-client php5-mysql

Note: If you have already installed php4, you should make a slight change like this.

apt-get install mysql-server mysql-client php4-mysql

The configuration file of mysql is located at: /etc/mysql/my.cnf

 

Creating users to use MySQL and Changing Root Password

By default mysql creates user as root and runs with no passport. You might need to change the root password.

To change Root Password

mysql> USE mysql;
mysql> UPDATE user SET Password=PASSWORD('new-password') WHERE user='root';
mysql> FLUSH PRIVILEGES;

You must never use root password, so you might need to create a user to connect to mysql database for a PHP script. Alternatively you can add users to mysql database by using a control panel like webmin or phpMyAdmin to easily create or assign database permission to users. We will install Webmin and phpmyadmin during later once we complete basic installation.

 

3. PhpMyAdmin Installation

PhpMyAdmin is a nice web based database management and administration software and easy to install and configure under apache. Managing databases with tables couldnt be much simpler by using phpmyadmin.

All you need to do is:

apt-get install phpmyadmin

The phpmyadmin configuration file is located at: /etc/phpmyadmin folder.

To set up under Apache all you need to do is include the following line in /etc/apache2/apache2.conf:

Include /etc/phpmyadmin/apache.conf 

Now restart Apache:

/etc/init.d/apache2 restart

Point your browser to: http://domain/phpmyadmin

That's it! MySQL and phpMyAdmin are ready. Log in with your mysql root password and create users to connect to database from your php script.

This tutorial was written and contributed to HowToForge by Scott  who currently runs MySQL-Apache-PHP.com. Permission is fully granted to copy/republish this tutorial in any form, provided a source is mentioned with a live link back to the authors site.


上一篇:使用apt-mirror构建本地Debian镜像   下一篇:Slackware10.2做NAT服务器


收藏于收藏夹】 【评论】 【推荐】 【打印】 【关闭
相关文档
·使用apt-mirror构建本地Debian镜像
·Slackware10.2做NAT服务器
·让Linux NAT服务器支持UPnP
·利用IP 别名托管多个SSL 站点
·CentOS下用OpenSSH构建SSH服务器
·用SSH客户端软件登录到服务器
·使用 mailman 架设邮件列表
·Ubuntu Linux 下的带宽监测工具
·Linux内核: 修改TCP/IP调优参数
·对Rsync的一些了解
·用Perl管理 Linux 配置文件
·详细介绍对Samba的三种典型配置方法
·在 Linux 上进行自动备份
·在 Linux 上构建 Web spider
·在 Linux 上构建网络路由器
·使用 ssh 进行安全的连接
发表评论
密码: 匿名评论
评论内容:

(不超过250字,需审核后才会公布,请自觉遵守互联网相关政策法规)
 
  最新文档
·VMware下让Linux系统与真实主机共享上
·Linux系统下服务器的硬件检查和文件传
·在虚拟机Redhat Linux下安装Samba服务
·Linux操作系统下PPPOE拨号共享上网方法
·xManager连接Linux的配置方法
·Linux和Window系统远程桌面相互访问方
·Ubuntu下用手机连接蓝牙局域网pan/pand
·如何解决Xmanager不能登陆Linux系统问
·通过Amora用symbian手机控制Linux计算
·在Linux操作系统下单网卡实现双IP的设
·Linux下使用Openssh工具远程管理Solari
·VMware下Linux与真实主机共享上网的方
  阅读排行
·LVS集群学习笔记(NAT\DR\IP tunnel)
·Linux系统邮件服务器常见错误报告列表
·防火墙也能DIY----免费的专业级防火墙M
·linux下文件服务Vsftp详细介绍
· 快速架设apache/vsftpd/samba/sendmai
· Linux下Tomcat配置技巧详解分析
·如何利用集群技术实现Web服务器的负载
·Suse Linux下的samba设置用户说明
·Linux操作系统下SVN服务器的搭建详解
·RHEL5实现高可用HA集群+GFS+Enterprise
· Snort 用户手册
·使用 screen 管理你的远程会话
·Linux操作系统下的集群工作原理及实战
·用Xmanager远程管理LINUX,AIX等UNIX系
·在VMware的虚拟机平台上如何进行网络设
网摘收藏: