‘壹’ ubantu下如何配置lamp
零基础不适合自学的
ubuntu本身就内置了lamp-server的
单独配置amp,需要apt很多包的,做为程序员只是搭个开发环境,大可不必像网络服务器那样配置,可以使用tasksel在root管理员权限下直接安装lamp-server套件(ubuntu自带的)。
使用tasksel安装lamp-server很简单:
1 你按ctrl+alt+t 打开命令行的终端窗口,执行命令:sudo passwd root,回车后提示要输入当前用户密码,验证通过后会提示设置root密码,重复密码。再重新启动用root登陆。
如果没安装tasksel要先安装sudo apt-get install tasksel
2在终端窗口,执行命令 :sudo tasksel install lamp-server,安装过程中会提示你输入mysql的root密码。
3在文件夹/var/www/下,创建个php文件用浏览器测试下,如果看到内容就成功了,如果提示是否保存这个php文件?执行命令:sudo /etc/init.d/apache2 restart, 重新启动apache就可以了
当然另一种简单可行方案就是 用集成开发包 xampp 等
‘贰’ 在Archlinux下重启Lamp的命令是什么怎么配置
lamp分别有几个服务:
systemctl restart mysql
systemctl restart httpd
‘叁’ lamp怎么修改mysql密码
1.通过命令修改,具体如下:
a、停止MySQL服务
执行:/etc/init.d/mysql stop
b、跳过验证启动MySQL
/usr/local/mysql/bin/mysqld_safe –skip-grant-tables >/dev/null 2>&1 &
然后:
mysql mysql -uroot//登陆 mysql> UPDATE user SET Password=PASSWORD(‘new password’) where USER=’root’; mysql> FLUSH PRIVILEGES; mysql> quit
然后重新启动mysql
/etc/init.d/mysql start
OK 这样就完成了,如果你感觉这样复杂的话,可以用第二种方法.
‘肆’ 怎么在linux 里搭建LAMP环境
要安装
MySQL,可以在终端提示符后运行下列命令:sudo
apt-get
install
mysql-server
mysql-client一旦安装完成,MySQL
服务器应该自动启动。您可以在终端提示符后运行以下命令来检查
MySQL
服务器是否正在运行:sudo
netstat
-tap|grep
mysql当您运行该命令时,您可以看到类似下面的行:tcp
0
0
localhost.localdomain:mysql
*:*
LISTEN
检查mysql安装情况-如果服务器不能正常运行,您可以通过下列命令启动它:sudo
/etc/init.d/mysql
restart另外,我们这里也介绍一下利用“新立得软件包管理器”安装Mysql,需要安装mysql-client和mysql-server两个软件包。如下图:选中mysql-client和mysql-client
5.0两个安装包选中mysql-server和mysql-server
5.0两个安装包软件程序包下载设置mysql-server-5.0用户密码默认的MySQL安装之后根用户是没有密码的,所以这里我们可以键入一个初始密码。
‘伍’ LAMP安装教程:Ubuntu 12.04 LTS server安装Apache2+PHP5+MySQL
LAMP是linux
web服务器组合套装的缩写,分别是Apache+MySQL+PHP。此教程教大家如何在Ubuntu12.04
LTS
server
上安装Apache2服务器,包括PHP5(mod_php)+MySQL。
此教程中使用的相关IP等设置,在你的环境中要做相应修改。
1
我们使用root账户进行安装,首先切换到root账户,输入命令:
sudo
su
2
安装
MySQL
5
输入命令:
apt-get
install
mysql-server
mysql-client
安装过程中需要设置root账户密码,系统会作以下提示:
New
password
for
the
MySQL
“root”
user:Repeat
password
for
the
MySQL
“root”
user:
3
安装
Apache2
输入命令:
apt-get
install
apache2
在浏览器输入你服务器地址列入
http://192.168.0.100查看Apache2是否工作,如果显示(It
works!),说明已经工作。
4
安装
PHP5
安装
PHP5
和
Apache
PHP5
模块:
apt-get
install
php5
libapache2-mod-php5
然后重启apache:
‘陆’ lamp怎么打开redis扩展
首先开启redis服务:打开cmd命令窗口,将根目录切换至redis根目录;开启redis服务:输入命令:redis-server.exe redis.conf 然后回车。开启成功后,此窗口不要关闭,另打开一个cmd窗口,连接客户端: 1.打开cmd命令窗口,将根目录切换至redis根目录; 2.输入连接命令:redis-cli.exe -h 127.0.0.1 -p 6379 然后回车 3.输入key的查看命令:keys *
‘柒’ 如何在命令行用命令创建一个laravel框架中名为lamp的控制器
控制器就是接收用户指令,比如你点击查看一篇文章,指令通过路由到达控制器,控制器接收到指令参数把数据准备好,发送到页面展示给你。M模型V视图C控制器,分离开更清晰。
‘捌’ 如何在Ubuntu上面安装LAMP环境
LAMP是一组开源软件的集合体,用来作为网站服务器的生产环境,这里简单的告诉大家如何在当前流行的Linux发型版本Ubuntu上面安装LAMP环境。
第一步:安装Apache
先更新一下还是有必要的对吧?
sudo apt-get update
sudo apt-get install apache2
就这么简单,完了!检查一下是不是安装成功:直接在浏览器里面输入VPS的IP看看,是不是有”“It works!"“类似的东西出现?有,那就可以了!
不知道自己的ip? 试试:ifconfig eth0 | grep inet | awk '{ print $2 }'
第二步:安装MySQL
sudo apt-get install mysql-server libapache2-mod-auth-mysql php5-mysql
在MySQL安装期间会让你输入MySQL的root密码,如果你错过了那也没关系后面可以在shell里面修改。
启动MySQL: 安装完成后我们输入sudo mysql_install_db 就启动了
技术MySQL的设置脚本:
sudo /usr/bin/mysql_secure_installation
接下来提示让你输入root密码:
Enter current password for root (enter for none):
OK, successfully used password, moving on...
接下来会提示你是否需要修改密码,我么这里选择N,继续下面的步骤。接下来就是最简单的输入yes和no了,知道MySQL重启:
By default, a MySQL installation has an anonymous user, allowing anyone
to log into MySQL without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
proction environment.
Remove anonymous users? [Y/n] y
... Success!
Normally, root should only be allowed to connect from 'localhost'. This
ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? [Y/n] y
... Success!
By default, MySQL comes with a database named 'test' that anyone can
access. This is also intended only for testing, and should be removed
before moving into a proction environment.
Remove test database and access to it? [Y/n] y
- Dropping test database...
... Success!
- Removing privileges on test database...
... Success!
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
Reload privilege tables now? [Y/n] y
... Success!
Cleaning up...
上面这就完成了MySQL,接下来我们来搞PHP。
第三步,安装PHP
输入 sudo apt-get install php5 libapache2-mod-php5 php5-mcrypt
接下来在提示让你两次确定YES后,PHP就自己开始安装了。
设置个PHP目录下的default 文件也许对你有用(非必须)
sudo nano /etc/apache2/mods-enabled/dir.conf
加入:
DirectoryIndex index.php index.html index.cgi index.pl index.php index.xhtml index.htm
PHP有很多有用的组件什么的可以帮你:
输入
apt-cache search php5-
接下来会显示一大堆,大概像这样:
hp5-cgi - server-side, HTML-embedded scripting language (CGI binary)
php5-cli - command-line interpreter for the php5 scripting language
php5-common - Common files for packages built from the php5 source
php5-curl - CURL mole for php5
php5-dbg - Debug symbols for PHP5
php5-dev - Files for PHP5 mole development
php5-gd - GD mole for php5
php5-gmp - GMP mole for php5
php5-ldap - LDAP mole for php5
php5-mysql - MySQL mole for php5
php5-odbc - ODBC mole for php5
php5-pgsql - PostgreSQL mole for php5
php5-pspell - pspell mole for php5
php5-recode - recode mole for php5
php5-snmp - SNMP mole for php5
php5-sqlite - SQLite mole for php5
php5-tidy - tidy mole for php5
php5-xmlrpc - XML-RPC mole for php5
php5-xsl - XSL mole for php5
php5-adodb - Extension optimising the ADOdb database abstraction library
php5-auth-pam - A PHP5 extension for PAM authentication
[...]
一旦你选定你需要安装的模块的话你只要输入类似这样的命令:
sudo apt-get install name of the mole
你可以一次安装一个或者多个组件。
还想继续?没了!
第四步,在服务器上查看自己的PHP信息
创建个文件:sudo nano /var/www/info.php,在里面添加:
phpinfo();
?>
保存退出!
接下来重启Apache:
sudo service apache2 restart
在:http://ip/info.php下就能看到你需要和缺少的东西了!
‘玖’ 如何搭建LAMP环境
首先为了搭建一个稳定的lamp的练习环境,确保你的虚拟机可以连网,这里我们使用的yum安装,它可以帮助我们解决软件自己的依赖关系.我还在后面加了postgresql数据库如果不需要的话可以去掉和postgresql的参数.命令如下
yum -y install httpd mysql mysql-server php php-mysql postgresql postgresql-server php-postgresql php-pgsql php-devel
‘拾’ Linux中自动解压/root/lamp下所有压缩包的命令
tar –xvf file.tar //解压 tar包
tar -xzvf file.tar.gz //解压tar.gz
tar -xjvf file.tar.bz2 //解压 tar.bz2
tar –xZvf file.tar.Z //解压tar.Z
unrar e file.rar //解压rar
unzip file.zip //解压zip
把file换成/root/lamp/*