openSUSE 12.1下搭建Web服务器

5 篇文章 0 订阅
3 篇文章 0 订阅
openSUSE 12.1下安装MySQL5

  2.安装MySQL5

  首先我们需要先用下面的命令安装MySQL5:

  yast2 -i mysql mysql-client mysql-community-server

  然后我们需要创建MySQL系统的启动键链接启动MySQL服务器,这样以便于MySQL在系统启动时自动启动,

  systemctl enable mysql.service
  systemctl start mysql.service

  为了确保MySQL的安装完成,运行:

  mysql_secure_installation

  下面会遇到下面的提示问题;

  server1:~ # mysql_secure_installation
  NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
  SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!
  In order to log into MySQL to secure it, well need the current
  password for the root user. If youve just installed MySQL, and
  you havent set the root password yet, the password will be blank,
  so you should just press enter here.
  Enter current password for root (enter for none):
  OK, successfully used password, moving on...
  Setting the root password ensures that nobody can log into the MySQL
  root user without the proper authorisation.
  Set root password? [Y/n] 输入Y
  New password: 设置数据库密码
  Re-enter new password: 重新输入数据库密码
  Password updated successfully!
  Reloading privilege tables..
  ... Success!
  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
  production 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 production 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...
  All done! If youve completed all of the above steps, your MySQL
  installation should now be secure.
  Thanks for using MySQL!
  server1:~ #

  现在你的MySQL安装应成功了

  openSUSE 12.1下安装Apache2

  Apache2的是作为一个openSUSE的软件包,因此,我们可以用下面命令安装它:

  yast2 -i apache2

  现在配置系统在引导时启动Apache

  systemctl enable apache2.service

  并启动Apache2

  systemctl start apache2.service

  现在,在您的浏览器输入http://192.168.0.100,你应该看到Apache2的首页页(不用担心403错误,这种情况,因为有没有索引文件(例如index.html的文件根目录)) :





  错误提示

  Apache的默认文档根目录是在openSUSE上的/srv/www/htdocs/目录 ,配置文件是/etc/apache2/httpd.conf。配置存储在的/etc/apache2/conf.d /目录。

  4.安装PHP5

  我们可以安装PHP5和Apache的PHP5的模块如下:

  yast2 -i apache2-mod_php5

  事后我们必须重新启动Apache:

  systemctl restart apache2.service

  openSUSE 12.1下此时PHP5

  5.测试PHP5并获取PHP5的安装信息

  默认网站的文件根目录是在/srv/www/htdocs/中。现在我们将在该目录中创建一个小型PHP文件(info.php的)和在浏览器中调用它。该文件将显示很多关于我们的PHP安装,如安装的PHP版本和有用的一些细节。

  vi /srv/www/htdocs/info.php





  PHP设置

  如果您得到的消息是你没有一个有效的Vim安装的二进制软件包。请安装“VIM”,“vim的增强型”或者“gvim”,请运行:

  yast2 -i vim

  安装VI并再次尝试。

  现在,我们请在浏览器(如文件http://192.168.0.100/info.php):





  PHP首页

  正如你所看到的,PHP5的工作,它通过Apache 2.0的处理程序,在服务器API线。如果你继续向下滚动,你会看到所有在PHP5中已经启用的模块。MySQL是没有列出,这意味着我们没有在PHP5支持MySQL。

  6.获得MySQL支持

  让PHP在MySQL中获得支持,我们可以安装的php5-mysql软件包。安装一些其他的PHP5模块,以及您可能需要的应用程序,这是一个好主意:

  yast2 -i php5-mysql php5-bcmath php5-bz2 php5-calendar php5-ctype php5-curl php5-dom php5-ftp php5-gd php5-gettext php5-gmp php5-iconv php5-imap php5-ldap php5-mbstring php5-mcrypt php5-odbc php5-openssl php5-pcntl php5-pgsql php5-posix php5-shmop php5-snmp php5-soap php5-sockets php5-sqlite php5-sysvsem php5-tokenizer php5-wddx php5-xmlrpc php5-xsl php5-zlib php5-exif php5-fastcgi php5-pear php5-sysvmsg php5-sysvshm

  现在重新启动Apache2的:

  systemctl restart apache2.service

  现在,重载http://192.168.0.100/info.php在您的浏览器,并再次向下滚动到模块部分。现在,你应该找到许多新的模块,包括MySQL模块:





  MYSQL显示

  openSUSE 12.1下安装phpMyAdmin

  7. 安装phpMyAdmin

  phpMyAdmin是一个网络接口,通过它可以管理你的MySQL数据库。

  phpMyAdmin的可安装如下:

  yast2 -i phpMyAdmin

  为了确保我们稍后通过ISPConfig创建的所有网站访问phpMyAdmin的可以和登录使用phpmyadmin(http://www.example.com/phpmyadmin)和phpMyAdmin(如http://www.example.com/phpMyAdmin),打开/ etc/apache2/conf.d/phpMyAdmin.conf文件设置

  vi /etc/apache2/conf.d/phpMyAdmin.conf

  并开始添加以下两个别名:





  设置别名

  重新启动Apache:

  systemctl restart apache2.service

  在地址栏输入http://192.168.0.100/phpMyAdmin/:你就可以访问phpMyAdmin了。



  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值