This page will describe the steps you have to take to install LAMP, which stands for Linux Apache MariaDB PHP. This page will show you, how to set up a working Apache2 webserver, a configured MariaDB database server, to install PHP5, working with Apache, and finally, phpMyAdmin with a configured pmadb database.

This article is updated to reflect the installation in openSUSE 13.1. However it it does not deviate much from lower versions of openSUSE.

Getting root access

Every time you want to change anything to the system, you will need root access. You can get this by:

  • Open a command line program (konsole is the standard one).
  • Type
    su -

The console will now ask you for the password you selected at the installation, enter that password and press enter again. If you logged in successfully, the user name and the computer name should be displayed in red now.


Setting up Apache2

Installing Apache2

To install software, make sure that you have root access. We will install our software using YaST from the command line.

  • Open a console.
  • To install apache, we use the command
    yast -i apache2

    or

    zypper in apache2

    .

This also installs the packet apache2-example-pages, which provides an example page when accessing the web server.

Starting Apache2

To start Apache, execute

systemctl start apache2.service

Note: If you ever want to restart apache, execute

systemctl restart apache2.service

or if you want to stop it

systemctl stop apache2.service

This does not start the apache server after a reboot. To enable that, give the command

systemctl enable apache2.service

Testing the installation

Now that you have installed apache2, you want to check if it works. The packet apache2-example-pages installed the file /srv/www/htdocs/index.html, which contains:

<html><body><h1>It works!</h1></body></html>

Note: You can create a new file and edit it by using your favorite editor.

You can now start your favorite browser. Navigate to 'localhost'. You should see 'It works!'.

Enabling public access to the web server

In this state the web server is only accessible as localhost. You have to open port http (=80) in the firewall. You can do that using YaST, selecting Security and Users --> Firewall --> Allowed services and add HTTP server. You may also edit the line with FW_CONFIGURATIONS_EXT= in it in the file /etc/sysconfig/SuSEfirewall2 and add apache2 in that line. A space is used in that line to separate elements. After editing you have to restart the firewall using:

systemctl restart SuSEfirewall2.service

Setting up PHP5

Installing PHP5

To install software, you need root access. When you have root access, execute

yast -i php5 php5-mysql apache2-mod_php5

or

zypper in php5 php5-mysql apache2-mod_php5

Don't forget to enable mod-php by executing

a2enmod php5

Now you have installed PHP5.

Restarting the webserver

Now that you have installed PHP5, you have to restart the apache2 webserver to get some results. You can restart apache by executing

systemctl restart apache2.service

with root access.

Testing the installation

That was pretty easy, but now you want to test it out, don't you? So, we go to the htdocs folder again by executing

cd /srv/www/htdocs

Make a new file named index.php and with the following content:

<?php echo "<h1>You succesfully installed PHP5!</h>" ?>

Now, open your favorite browser again and navigate to 'localhost/index.php'. If everything went alright then you should see 'You successfully installed PHP5!'.

Setting up MariaDB

Installing MariaDB

We need to install mariadb and mariadb-tools, mariadb-tools is necessary for the administration, execute

yast -i mariadb mariadb-tools

or

zypper in mariadb mariadb-tools

with root access.

Starting the MariaDB server

MariaDB is an alternative package for MySQL, so further on the name mysql is used.

To start the MariaDB server, execute

systemctl start mysql.service

You may want to read the messages issued by the server in /var/log/messages.

Note: If you ever want to restart mysql, execute

systemctl restart mysql.service

or if you want to stop it

systemctl stop mysql.service

This does not start the mysql server after a reboot. To enable that, give the command

systemctl enable mysql.service

Configuring the MariaDB/MySql server

To set the root password for the first time:

  • Execute

    mysqladmin -u root password NEWPASSWORD
    • If you want to set the password to root123, type

      mysqladmin -u root password root123

If you ever want to change your password later:

  • Type

    mysqladmin -u root -p password NEWPASSWORD
  • Your old password will be asked.

Logging in to the client

Now you can log in into the server client by executing

mysql -u root -p

Enter

exit

to go back to the terminal.

Installing phpMyAdmin

What is phpMyAdmin?

phpMyAdmin, or pma is a tool to administrate your databases. The installation process is quite easy.

Installing phpMyAdmin

Install phpMyAdmin by executing

yast -i phpMyAdmin

or

zypper in phpMyAdmin

This also installs a number of needed php5 modules and restarts the apache2 server.

Logging into phpMyAdmin

To log in to phpMyAdmin:

  • Navigate to localhost/phpMyAdmin
  • Enter the root username and the root password of your mysql server
  • Click on the 'go' button

Configuring phpMyAdmin

To configure phpMyAdmin, we need to edit the configuration file. It is found in /etc/phpMyAdmin/config.inc.php.

  • Open the file and change corresponding lines to (note the double underscore in the names of the tables):
$cfg['Servers'][$i]['controluser'] = 'somename';
$cfg['Servers'][$i]['controlpass'] = 'somepassword';
/*Advanced phpMyAdmin features */
$cfg['Servers'][$i]['pmadb'] = 'phpmyadmin';
$cfg['Servers'][$i]['bookmarktable'] = 'pma__bookmark';
$cfg['Servers'][$i]['relation'] = 'pma__relation';
$cfg['Servers'][$i]['table_info'] = 'pma__table_info';
$cfg['Servers'][$i]['table_coords'] = 'pma__table_coords';
$cfg['Servers'][$i]['pdf_pages'] = 'pma__pdf_pages';
$cfg['Servers'][$i]['column_info'] = 'pma__column_info';
$cfg['Servers'][$i]['history'] = 'pma__history';
$cfg['Servers'][$i]['tracking'] = 'pma__tracking';
$cfg['Servers'][$i]['designer_coords'] = 'pma__designer_coords';
  • You will need to change the user name of controluser to the name of a new account (above somename) and controlpass (above somepassword) to it's password.
  • Change the protection of this file so it is owned by root and only readable by group www.
    chown root:www /etc/phpMyAdmin/config.inc.php
    chmod 640 /etc/phpMyAdmin/config.inc.php
  • Log in to localhost/phpMyAdmin again.
  • Import via the Import tab on the phpMyAdmin page the file /usr/share/doc/packages/phpMyAdmin/example/create_tables.sql There is a comment telling you that a user pma should be present already, however this is not necessary.
  • Log in and out again using user name root and the root password of MySQL.
  • Select the tab Users and press Add user. Enter as new user name the name of controluser chosen above, localhost as host, twice the above chosen password in the corresponding fields and press Go (below right).
  • Create a file with the following content, where somename and somepassword are replaced by the above chosen values.
GRANT USAGE ON mysql.* TO 'somename'@'localhost' IDENTIFIED BY 'somepassword';
GRANT SELECT (
Host, User, Select_priv, Insert_priv, Update_priv, Delete_priv,
Create_priv, Drop_priv, Reload_priv, Shutdown_priv, Process_priv,
File_priv, Grant_priv, References_priv, Index_priv, Alter_priv,
Show_db_priv, Super_priv, Create_tmp_table_priv, Lock_tables_priv,
Execute_priv, Repl_slave_priv, Repl_client_priv
) ON mysql.user TO 'somename'@'localhost';
GRANT SELECT (Host, Db, User, Table_name, Table_priv, Column_priv)
ON mysql.tables_priv TO 'pmagebruiker'@'localhost';
GRANT SELECT ON mysql.db TO 'somename'@'localhost';
GRANT SELECT, INSERT, UPDATE, DELETE ON phpmyadmin.* TO 'somename'@'localhost';

and import that file via the Import tab.

  • Read the documentation on phpMyAdmin on the phpMyAdmin website.
  • Do not forget to take the necessary security measures.
  • You should have a working LAMP server now!

==================================================================

https://en.opensuse.org/SDB:LAMP_setup

https://en.opensuse.org/SDB:Linux_Apache_MySQL_PHP

http://os.51cto.com/art/201203/323578.htm

http://www.unixmen.com/install-lamp-server-apache-mariadb-php-opensuse-13-213-1/

http://ben-it.org/content/open-suse-123-install-lamp-server

Suse LAMP setup的更多相关文章

  1. Ubuntu 16.04 LAMP server tutorial with Apache 2.4, PHP 7 and MariaDB (instead of MySQL)

    https://www.howtoforge.com/tutorial/install-apache-with-php-and-mysql-on-ubuntu-16-04-lamp/ This tut ...

  2. openSUSE 安装LAMP记录

    按照 openSUSE SDB:LAMP setup安装好了LAMP.运行的大多数命令都是来自与openSUSE SDB:LAMP setup中. 本页面描述如何安装LAMP,这是 Linux Apa ...

  3. How To Install Development Tools In Linux

      In this brief tutorial, we will be discussing how to install development tools in popular Linux di ...

  4. How to install cacti on centos 6

    Cacti – Network and performance monitoring tool   Cacti is one of best monitoring tool used to monit ...

  5. 用于 ‘Suse‘ Linux 包管理的 Zypper 命令大全

    SUSE( Software and System Entwicklung,即软件和系统开发.其中‘entwicklung‘是德语,意为开发)Linux 是由 Novell 公司在 Linux 内核基 ...

  6. suse最小化安装

    Open suse 图形安装 用虚拟机vmware70 或者是Oracle VM VirtualBox安装 .镜像文件就是SLED-10-x86_64-DVD1 根据虚拟机设置吧镜像文件装入虚拟机中 ...

  7. 7. LAMP环境搭建

    一.准备工作 1.安装编译工具gcc.gcc-c++ 注意解决依赖关系,推荐使用yum安装,若不能联网可使用安装光盘做为yum源-- 1)编辑yum配置文件: # mount /dev/cdrom / ...

  8. lamp php的ssl,ssh支持

    Php支持ssl,ssh扩展: 准备:可以成功解析php 1.curl的安装 [root@localhost~]# cd /usr/local/src/ [root@localhost~]# wget ...

  9. 【Mail】搭建邮件服务器(LAMP+Postfix+Dovcot+PostfixAdmin+Roundcubemail)

    大纲 一.mail部署说明 二.安装准备 三.LMAP环境配置 四.配置postfixadmin 五.配置postfix 六.配置dovecot 七.测试SMTP和POP3服务 八.配置Roundcu ...

随机推荐

  1. inline-block BUG问题

    使用inline-block会使父元素高度不正常,要慎用!!!可以给父元素添加font-size:0解决,或者使用用float或者flex布局.

  2. sencha touch 手势识别左右滑动

    sencha touch 中添加手势识别非常简单,就是监听 dom 元素的 move 事件: 1. 为你的 view 注册 swipe 事件 // 为当前 view 注册手势滑动事件 Ext.get( ...

  3. 【CSS】 布局之浮动float和绝对定位absolute的选择

    浮动float: 浮动的框可以向左或向右移动,直到它的外边缘碰到包含框或另一个浮动框的边框为止. 由于浮动框不在文档的普通流中,所以文档的普通流中的块框表现得就像浮动框不存在一样.(W3C) 绝对定位 ...

  4. OpenCV文本图像的旋转矫正

    用户在使用Android手机拍摄过程中难免会出现文本图像存在旋转角度.这里采用霍夫变换.边缘检测等数字图像处理算法检测图像的旋转角度,并根据计算结果对输入图像进行旋转矫正. 首先定义一个结构元素,再通 ...

  5. Android 再谈handler

    今天在做http网络事件的响应网络接收处理一般不能放在主线程中使用,目前也只会使用AsyncTask进行处理!之前虽然写过handler处理的一些文章但是发现全不会了!无奈~ 关于handler某位兄 ...

  6. c#,利用WPF的ScaleTransform和TranslateTransform实现图片的缩放效果

    一.缩放要求 1.缩放对象在可视区域内,已对象的中心点进行缩放. 2.缩放对象比可视区大,并且对象各边界都在可视区外围,那么已鼠标位置进行缩放. 3.缩放对象比可视区大,但是缩放后某一边界在可视区的对 ...

  7. Java入门系列-15-封装

    为什么要封装 Student stu=new Student(); stu.age=-10; 上面的代码中 age 属性被随意访问,容易产生不合理的赋值 什么是封装 封装:将类的某些信息隐藏在内部,不 ...

  8. Scrum 冲刺博客第二篇

    一.当天站立式会议照片一张 二.每个人的工作 (有work item 的ID),并将其记录在码云项目管理中 昨天已完成的工作 配置和连接微信小程序服务器 个人界面设计 部主页界面设计 答题界面设计 今 ...

  9. 【转】“无法从http://XXX/XXX.svc?wsdl获取元数据”错误的解决方法

    昨天在用IIS部署一个WCF服务时,碰到了如下错误: 理解了文档内容,但无法进行处理.  - WSDL 文档包含无法解析的链接.  - 下载“http://admin-pc/IISHostServic ...

  10. 问题集录06--SpringBoot创建Maven项目

    1. 如下图,打开idea之后,file -> new -> project2. 如下图,在弹出的new project 页面,选择maven -> 勾选Create from ar ...