安装常用的工具和库 安装Linux下常用的工具和库,例如python2.7、libxml2、apt-src等。 - sudo apt-get update
- sudo apt-get install python2.7-dev
- sudo apt-get install libxml2-dev
- sudo apt-get install apt-src \
- scons \
- mingw32-runtime \
- p7zip-full \
- gawk \
- gzip \
- perl \
- autoconf \
- m4 \
- automake \
- libtool \
- libncurses5-dev \
- gettext \
- gperf \
- dejagnu \
- expect \
- tcl \
- autogen \
- flex \
- flip \
- bison \
- tofrodos \
- texinfo \
- g++ \
- gcc-multilib \
- libgmp3-dev \
- libmpfr-dev \
- debhelper \
- texlive \
- texlive-extra-utils
复制代码
安装Apache 我尝试使用指令“sudo apt-get install apache2”,但是它没有正确安装Apache(我无法运行“sudo service apache2 restart”)。所以我重新编译源码后再进行安装。 下载源代码: - cd
- mkdir tmp
- cd tmp
- wget http://tux.rainside.sk/apache//httpd/httpd-2.2.31.tar.bz2
- tar -xvf httpd-2.2.31.tar.bz2
- cd httpd-2.2.31
复制代码
编译并安装Apache: - ./configure --prefix=/usr/local/apache2
- make
- make install
复制代码
设置“ServerName”。打开“/usr/local/apache2/conf/httpd.conf”文件。 - nano /usr/local/apache2/conf/httpd.conf
复制代码
查找“ServerName”,放置以下代码:
重新启动后Apache自动启动。 创建“/etc/init.d/apache2”: - sudo nano /etc/init.d/apache2
复制代码
将以下内容添加到该文件: - #!/bin/sh
- case "$1" in
- start)
- echo "Starting Apache ..."
- # Change the location to your specific location
- /usr/local/apache2/bin/apachectl start
- ;;
- stop)
- echo "Stopping Apache ..."
- # Change the location to your specific location
- /usr/local/apache2/bin/apachectl stop
- ;;
- graceful)
- echo "Restarting Apache gracefully..."
- # Change the location to your specific location
- /usr/local/apache2/bin/apachectl graceful
- ;;
- restart)
- echo "Restarting Apache ..."
- # Change the location to your specific location
- /usr/local/apache2/bin/apachectl restart
- ;;
- *)
- echo "Usage: '$0' {start|stop|restart|graceful}"
- exit 64
- ;;
- esac
- exit 0
复制代码
编辑权限: - sudo chmod u+x /etc/init.d/apache2
复制代码
重新启动后使用以下指令启用自动启动: - sudo update–rc.d apache2 defaults #possibly try without sudo
复制代码
启动服务器: - sudo service apache2 start
复制代码
注意:可能会用到一下指令: - /usr/local/apache2/bin/apachectl start #original path
- sudo service apache2 stop
- sudo service apache2 start
- sudo service apache2 restart
复制代码
测试WEB服务器是否工作 检查OpenRex的IP地址,运行: - root@ubuntu-imx6:/usr/local/apache2/htdocs# ifconfig
- eth0 Link encap:Ethernet HWaddr 00:0d:15:00:dc:ed
- inet addr:192.168.0.39 Bcast:192.168.0.255 Mask:255.255.255.0
- inet6 addr: fe80::20d:15ff:fe00:dced/64 Scope:Link
- UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
- RX packets:11705 errors:0 dropped:0 overruns:0 frame:0
- TX packets:10807 errors:0 dropped:0 overruns:0 carrier:0
- collisions:0 txqueuelen:1000
- RX bytes:12306971 (12.3 MB) TX bytes:1443867 (1.4 MB)
-
- lo Link encap:Local Loopback
- inet addr:127.0.0.1 Mask:255.0.0.0
- inet6 addr: ::1/128 Scope:Host
- UP LOOPBACK RUNNING MTU:65536 Metric:1
- RX packets:12 errors:0 dropped:0 overruns:0 frame:0
- TX packets:12 errors:0 dropped:0 overruns:0 carrier:0
- collisions:0 txqueuelen:0
- RX bytes:656 (656.0 B) TX bytes:656 (656.0 B)
-
- root@ubuntu-imx6:/usr/local/apache2/htdocs#
复制代码
可以看到,OpenRex的IP地址是192.168.0.39。转到PC或者Linux主机,打开互联网浏览器,输入网址:“http://192.168.0.39”,你应该看到一个页面:
很不错,它工作了。所有的apache文件位于“/usr/local/apache2/”,这意味着,该网站的页面都位于“/usr/local/apache2/htdocs/”里面。如果你喜欢的话,可以试着改变当前页面。运行“nano”来编辑“index.html”文件: - nano /usr/local/apache2/htdocs/index.html
复制代码
你可以像这样进行编辑: - <html><body><h1>It works! Perfect!</h1></body></html>
复制代码
刷新OpenRex网站,你应该会看到:
安装MySQL 运行以下指令来安装MySQL: - sudo apt-get install mysql-server
复制代码
安装过程中设置admin的密码。测试MySQL是否正在运行: - root@ubuntu-imx6:~/tmp/php-5.6.19# sudo netstat -tap | grep mysql
- tcp 0 0 127.0.0.1:mysql *:* LISTEN 21100/mysqld
- root@ubuntu-imx6:~/tmp/php-5.6.19#
复制代码
注意:如果服务器没有正常运行,您可以键入以下命令来启动它: - sudo service mysql restart
复制代码
注意:如果你想改变MySQL的默认配置,该文件位于:
安装PHP 下载源代码: - cd ~/tmp
- wget http://php.net/get/php-5.6.19.tar.bz2/from/this/mirror
- mv mirror php-5.6.19.tar.bz2
- tar -xvf php-5.6.19.tar.bz2
- cd php-5.6.19
复制代码
配置、编译以及运行PHP测试: - ./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql
- make
- make test
复制代码
安装PHP: - make install
- cp php.ini-development /usr/local/lib/php.ini
复制代码
如果需要更改的PHP配置,php.ini文件位于:/usr/local/lib/php.ini。
更新Web服务器配置 打开Web服务器的配置文件: - nano /usr/local/apache2/conf/httpd.conf
复制代码
搜索“php5_module”,并确保已启用。你应该看到类似这样的: - LoadModule php5_module modules/libphp5.so
复制代码
搜索“FilesMatch”,并添加以下内容,使其可以处理“PHP”文件: - <FilesMatch \.php[ DISCUZ_CODE_868 ]gt;
- SetHandler application/x-httpd-php
- </FilesMatch>
复制代码
搜索"DirectoryIndex",并告诉WordPress自动处理index.php: - DirectoryIndex index.php index.phtml index.html index.htm
复制代码
重新启动Web服务器 - sudo service apache2 restart
复制代码
测试PHP 创建 phpinfo.php文件: - nano /usr/local/apache2/htdocs/phpinfo.php
复制代码
里面放入以下内容:
转到你的OpenRex网站,并使用以下链接:“http://192.168.0.39/phpinfo.php”(不要忘记使用你的OpenRex的IP地址)。你应该会看到PHP信息的页面。
安装WordPress 在开始安装WordPress之前,我们将创建MySQL的WordPress用户: - mysql -u root -p
- #enter the root password which you used during MySQL installation. I used 'fedevel'
复制代码
创建OpenRex WordPress的数据库: - create database wordpress;
复制代码
创建OpenRex WordPress的用户: - create user 'wordpress'@'localhost' identified by 'fedevel';
复制代码
授予WordPress用户使用WordPress数据库的权限: - grant all on wordpress.* to 'wordpress'@'localhost' identified by 'fedevel';
- quit;
复制代码
现在下载WordPress文件: - cd ~/tmp
- wget https://wordpress.org/latest.tar.gz
- tar -zxvf latest.tar.gz
复制代码
备份当前的Web目录: - mkdir ~/tmp/webbackup
- mv /usr/local/apache2/htdocs/* ~/tmp/webbackup/
复制代码
复制WordPress文件到Web服务器目录: - cp -prv ~/tmp/wordpress/* /usr/local/apache2/htdocs/
复制代码
WordPress的Web安装 转到OpenRex网站(打开互联网浏览器,并输入OpenRex的IP地址)。本例中该网址是:http://192.168.0.39/,你会看到类似这样的:“欢迎使用WordPress。在开始之前,我们需要数据库的一些信息,在继续之前您需要了解以下事项.. “。 第1步:设置MySQL - Database Name: wordpress
- User Name: wordpress //use the user which you created in the steps above
- Password: fedevel //use the password which you assigned to the user
- Database Host: localhost
- Table Prefix: wp_
复制代码
第2步:wp-config.php文件 在该步骤中,您将看到一条信息,类似于:“对不起,我不能写入wp-config.php文件,您可以手动创建 wp-config.php并将下面的文本粘贴到里面”。创建“/usr/local/apache2/htdocs/wp-config.php”: - nano /usr/local/apache2/htdocs/wp-config.php
复制代码
并且从安装过程中的文本框里复制这些内容,它可能是这样的: - <?php
- /**
- * The base configuration for WordPress
- *
- * The wp-config.php creation script uses this file during the
- * installation. You don't have to use the web site, you can
- * copy this file to "wp-config.php" and fill in the values.
- *
- * This file contains the following configurations:
- *
- * * MySQL settings
- * * Secret keys
- * * Database table prefix
- * * ABSPATH
- *
- * @link https://codex.wordpress.org/Editing_wp-config.php
- *
- * @package WordPress
- */
-
- // ** MySQL settings - You can get this info from your web host ** //
- /** The name of the database for WordPress */
- define('DB_NAME', 'wordpress');
-
- /** MySQL database username */
- define('DB_USER', 'wordpress');
-
- /** MySQL database password */
- define('DB_PASSWORD', 'fedevel');
-
- /** MySQL hostname */
- define('DB_HOST', 'localhost');
-
- /** Database Charset to use in creating database tables. */
- define('DB_CHARSET', 'utf8mb4');
-
- /** The Database Collate type. Don't change this if in doubt. */
- define('DB_COLLATE', '');
-
- /**#@+
- * Authentication Unique Keys and Salts.
- *
- * Change these to different unique phrases!
- * You can generate these using the {@link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org secret-key service}
- * You can change these at any point in time to invalidate all existing cookies. This will force all users to have to log in again.
- *
- * @since 2.6.0
- */
- define('AUTH_KEY', 'F5k,gn[K14j,|wi:+{13;.1C;shnAz}|7y9^kgbj(6NHXN08@y6`vRug3H~,))ct');
- define('SECURE_AUTH_KEY', '<uYD@tZ=Ux18SZS3+0f@20O,wSegsz|<j|U>b%K|80b^Sz7)u[@5{HmWUqt/oc!t');
- define('LOGGED_IN_KEY', '0$b3sov2BQPPO6$S,=4zROwyttUy&dG(PMVEStXP04U]{9IwOxHE+}8KzlSYVop[');
- define('NONCE_KEY', 'H4|Z+Vqg-F+ogK60gGU2!N]CLa`|<1MVusE5g:lgI:^)`uUfG3ho#?KUqoh92RLx');
- define('AUTH_SALT', 'OCMVZ6(P/R3QSko?Z3vU&0+Eq@irqzYLRXSdH_:C6rl2l37J[=>v.NOK+Q&G9=*O');
- define('SECURE_AUTH_SALT', 'Z`n[NU4z5MBRpC=b-)bm2ai8Y$3T-~N[ZKIab8pDfBG@Bg-Y xo`QKrs6Q]Vb;eh');
- define('LOGGED_IN_SALT', 'n?+!( 0m,TaT5,]K/ zjfE|_Le%UZL-(NY(%3}s+aSFR*BOmJ[N@ jBm~TyUJc#U');
- define('NONCE_SALT', ' L%.#p$V)^0eSO b(Hl nYxRY$owA@xchkji(hetfIUv-iUDT=v`m%Fmf;ve?zoX');
-
- /**#@-*/
-
- /**
- * WordPress Database Table prefix.
- *
- * You can have multiple installations in one database if you give each
- * a unique prefix. Only numbers, letters, and underscores please!
- */
- $table_prefix = 'wp_';
-
- /**
- * For developers: WordPress debugging mode.
- *
- * Change this to true to enable the display of notices during development.
- * It is strongly recommended that plugin and theme developers use WP_DEBUG
- * in their development environments.
- *
- * For information on other constants that can be used for debugging,
- * visit the Codex.
- *
- * @link https://codex.wordpress.org/Debugging_in_WordPress
- */
- define('WP_DEBUG', false);
-
- /* That's all, stop editing! Happy blogging. */
-
- /** Absolute path to the WordPress directory. */
- if ( !defined('ABSPATH') )
- define('ABSPATH', dirname(__FILE__) . '/');
-
- /** Sets up WordPress vars and included files. */
- require_once(ABSPATH . 'wp-settings.php');
复制代码
第3步:运行安装 点击按钮“Run the install”。
第4步:设置基本的页面信息 - Site Title: RexFace //or what you like
- Username: fedevel //or what you like
- Password: fedevel //or what you like
- Your Email: username@example.com //put here your email, your OpenRex wordpress will send you important info e.g. password reset
- Search Engine Visibility: Check this, you may not want google to search through your OpenRex web (or if you want, you can uncheck it :)
复制代码
第5步:点击“安装WordPress” 只需按下按钮“Install WordPress”。
第6步:登录 点击“登录”按钮,登录到在OpenRex运行的RexFace网站。
重要提示:如果您的主板的IP地址发生改变,需要编辑“的functions.php”。在我们的示例中: - nano /usr/local/apache2/htdocs/wp-content/themes/twentysixteen/functions.php
复制代码
在“PHP?”后添加以下行: - update_option( 'siteurl', 'http://'.$_SERVER['SERVER_ADDR']);
- update_option( 'home', 'http://'.$_SERVER['SERVER_ADDR']);
复制代码它看起来就像这样: - <?php
- update_option( 'siteurl', 'http://'.$_SERVER['SERVER_ADDR']);
- update_option( 'home', 'http://'.$_SERVER['SERVER_ADDR']);
- /**
- * Twenty Sixteen functions and definitions
复制代码
这是必需的,因为当你将服务器移动到不同的IP地址,所有的内部网站链接仍然指向旧的IP地址。
|