Suse LAMP setup

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.

Contents

[hide]

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

时间: 2024-11-12 22:39:49

Suse LAMP setup的相关文章

CentOS 7 projectsend 如何设置文件共享工具

ProjectSend is an Open Source web file and image sharing tool for professionals that solve the issue of sharing files between a company and its clients. ProjectSend provides an easy and secure multi-file uploading and unlimited file size on ANY serve

Centos install Parosid

SELinux and Parosid To run the VisualEditor and Parsoid on a CentOS7-Server, you need to do the following. The requirement is a working MediaWiki (min. V1.25.x) setup. (Crate a LAMP setup on CentOS 7, RHEL 7, Fedora 22, or Scientific Linux 7) 1) Beco

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

SUSE( Software and System Entwicklung,即软件和系统开发.其中‘entwicklung‘是德语,意为开发)Linux 是由 Novell 公司在 Linux 内核基础上建立的操作系统.SUSE Linux 有两个发行分支.其中之一名为 openSUSE,这是一款自由而且免费的操作系统 (free as in speech as well as free as in wine).该系统由开源社区开发维护,支持一些最新版本的应用软件,其最新的稳定版本为 13.2.

How To Install Linux, Apache, MySQL, PHP (LAMP) stack on Ubuntu

About LAMP LAMP stack is a group of open source software used to get web servers up and running. The acronym stands for Linux, Apache, MySQL, and PHP. Since the virtual private server is already running Ubuntu, the linux part is taken care of. Here i

Fedora 23如何安装LAMP服务器

LAMP 是开源系统上 Web 服务器的梦幻组合.LAMP 是 Linux. Apache HTTP 服务. MySQL/MariaDB 数据库和 PHP. Perl 或 Python 的简称. 下面教你如何在 Fedora 23 服务器上安装 LAMP 组合. 下面的教程默认使用 192.168.1.102/24 实例,请按照你的服务器做修改. 安装 Apache Apache 是一款开源的 web 服务框架.完全支持 CGI, SSL. 切换到 root 账户: su Fedora 23/2

ansible之setup模块常用的信息

ansible的setup模块非常好用,但给出的信息十分全面,有时候我们并不需要全部的信息. 过滤出指定的信息:例->ansible all -m setup -a "filter=ansible_os_family" ansible_all_ipv4_addresses:仅显示ipv4的信息 ansible_devices:仅显示磁盘设备信息 ansible_distribution:显示是什么系统,例:centos,suse等 ansible_distribution_ver

20150309+Linux+LAMP安装-01

LAMP环境--Linux 目录 LAMP环境--Linux 1 一.文件操作 3 1.find 文件查找 3 2.df 磁盘分区信息 3 3.du统计文件大小信息 4 4.挂载磁盘 5 二.配置网络 6 1.配置文件 6 2.启动网络 6 3.ifconfig 查看网络信息 7 4.ping 测试网路是否畅通 7 5.Linux防火墙 9 三.FTP服务 10 1.FlashFXP软件使用 10 2.vsftpd服务 12 四.LAMP软件的安装 12 1.LAMP软件安装顺序 12 2.复制

lamp整合三连发(1)

LAMP安装日常中十分常见.在CentOS 6中默认的php5.3.0以下的版本不支持fpm fastCGI机制:需要自行打补丁或编译安装:默认安装的httpd 2.2没有对fasCGI的支持模块,所以在CentOS 6 中只能编译安装httpd2.4和php5.3.3+:在CentOS 7中默认安装的httpd 2.4新特性中加入了fastCGI的支持模块,php可以独立安装安装php-fpm包即可.今天就弄下三种模式下的LAMP搭建: (1)CentOS 7, lamp (module):

编译安装lamp环境与管理

一.安装一些下来要用到的包!1.安装OpenSSLtar zxvf openssl-0.9.8e.tar.gzcd openssl-0.9.8e./config --prefix=/usr/local/openssl sharedmakemake install修改(此步骤非常重要,至少对于现有的软件版本)vi /etc/ld.so.conf 添加一行/usr/local/openssl/lib//sbin/ldconfig 2.安装Curl库# tar -zxf curl-7.15.0.tar