Error: Network Error:connection refused
Workaround:
Perform
$sudo Apt-get Install Openssh-server
Installing the SSH Protocol
Perform ifconfig to show Ubuntu IP address
Using Putty to enter Ubuntu IP in XP telnet with SSH protocol
The process is as follows
Login As:jtone
[email protected]' s password:
Linux jtone-desktop 2.6.28-11-generic #42-ubuntu SMP Fri Apr 01:57:59 UTC i686
The programs included with the Ubuntu system is free software;
The exact distribution terms for each program is described in the
Individual files In/usr/share/doc/*/copyright.
Ubuntu comes with absolutely NO WARRANTY, to the extent permitted by
Applicable law.
To access official Ubuntu documentation, please visit:
http://help.ubuntu.com/
Last login:wed Feb 3 01:02:33 2010
[email protected]: ~$
Login successful
can operate remotely.
------------------------------------------------------------------------------------------------------------
"Off-topic"
Idle boredom to try to test the performance of their own projects on different operating systems, so decided to try to deploy Apache and Mono on Linux environment. Since there is very little contact with Linux, so from the Internet to find a few articles (attached to related links) to try, the deployment process is not smooth sailing, so according to their own configuration on Azure re-organized, hoping to have little contact with Linux students are helpful. All of the following operations are configured on a virtual machine on Azure, and if configured locally or in a virtual machine, you may need to configure the network card settings first.
"Article index"
- Installing Apache under Ubuntu
- Installing mono under Ubuntu
- Deploying an ASP. NET site under Ubuntu
- Operation under openSUSE
- Operation under CentOS
- RELATED LINKS
"One, install Apache under Ubuntu"
Ubuntu server after installation, the default is not a graphical interface, in fact, Linux without a graphical interface is also easy to configure. After configuring Ubuntu server on Azure (here using Ubuntu server 12.04 lts,2013/6/24 provided on azure), the SSH 22 port is automatically configured, and we can connect to the server directly using the SSH tool. Free Open Source Putty (http://www.putty.org/) is used here. If you configure the use of password to connect the host on the azure, then enter the address directly click "Open", if you also upload the SSH key, you should also select the corresponding key in the Connection/ssh/auth to connect.
After connecting the user name and password to enter the settings can be logged into the Ubuntu system, will appear as the command line, we do almost all of the work is done by the command line operation.
Installing the software under Ubuntu is really handy, and Ubuntu offers apt-get tools that you can use to download and install the software directly.
In Linux, the system's highest-privilege account is the root account, and the default login is not the root account, such as the installation program and other permissions, but the same as Windows provides the way to elevate permissions, is the sudo command, each command executed with "sudo", That is, you can execute the root account permissions. When using sudo for the first time, you will be asked to enter the password for the current account, and you can use the sudo command for a period of time (default 5 minutes) without having to enter a password, and then re-enter it after a period of inactivity.
First we install Apache, enter the following command, then prompt for installation, etc., enter Y to continue. Package Details: Http://packages.ubuntu.com/quantal/apache2
sudo apt-get install apache2
After waiting for a period of time, Apache will automatically install the configuration, this time you can configure the 80 port on Azure, configured after using the browser to access the server's address can be seen as a prompt, indicating that the installation was successful.
"Second, install mono under Ubuntu"
Linux has an open-source. NET runtime called Mono (http://www.mono-project.com/) that can support running. NET applications on Linux.
Still install the mono and C # compilers as described above by entering the following command, package details: Http://packages.ubuntu.com/quantal/mono-gmcs
sudo apt-get install Mono-gmcs
After installation you can enter "Mono-v" to view the installed mono version (note that V is uppercase), of course, you can also write a C # ConsoleApp look, you can compile C # code with the following command.
GMCs Test.cs
If there is no problem with the program, Test.exe is generated and can be executed by the following command. Of course, it is also possible to copy to Linux after compiling the exe file on Windows.
Mono Test.exe
Next, depending on the version that you need, choose to install Apache support for ASP. NET 2.0 or ASP. Mono-apache-server2 for ASP. NET 2.0, Mono-apache-server4 is an ASP. 4.0, the two can exist at the same time, the switch needs to switch in the Apache configuration file. Package Details: Http://packages.ubuntu.com/quantal/mono-apache-server2
sudo apt-get install Mono-apache-server2
Do not know why, install to the end will be stuck in this place
You can only force exit by CTRL + Z, and then enter "sudo reboot" to restart the server, but the Linux server will soon restart
Then install the Apache module Libapache2-mod-mono. Of course, Mono-gmcs, Mono-apache-server2, Libapache-mod-mono can all be installed together, but pay attention to the order of Mono-apache-server2 and Libapache-mod-mono, If Mono-apache-server2 is behind Libapache-mod-mono, Libapache-mod-mono will now automatically choose to install Mono-apache-server4 because of dependencies. Moreover, if installed together, in the above location of the jammed CTRL + Z restart, Libapache-mod-mono is not configured to complete a lot of operations can not be performed, but also need to execute "sudo dpkg--configure-a" command. Package Details: Http://packages.ubuntu.com/quantal/libapache2-mod-mono
sudo apt-get install Libapache2-mod-mono
However, if you open Web site discovery or cannot execute it, you are not configuring an ASP. Although it is now supported to configure applications automatically, it is still necessary to modify the/etc/apache2/mods-available/mod_mono.conf file. (see: http://www.mono-project.com/AutoConfiguration) Of course if you configure the application manually, you can also configure the application manually in the file (same as below).
sudo vim/etc/apache2/mods-available/mod_mono.conf
Press the I key on the keyboard to enable Vim's editing mode, because many parameters have been configured in the mono-server2-hosts.conf file, so only need to add "Monoautoapplication enabled" line in the figure. Also, if your site has other file formats (such as HttpHandler frequently used. Axd), add the first line behind it, and if the site default file is not index.aspx, you need to modify the file name after the second line. Note that because Linux is case-sensitive, it's important to remember not to mistake the case.
If you also have ASP. NET 4.0 support (MONO-APACHE-SERVER4) installed on the server, and you need to switch to ASP. NET 4.0, you only need to modify the last line and change the 2 to 4.
After modifying, press CTRL + C to end the edit mode, then press the colon key (:) to enter command mode, enter W to save the file, then press the colon key again, then press the Q key to exit Vim.
Finally, perform the following command to restart the Apache server.
"Iii. Deploying an ASP. NET site under Ubuntu"
Deploying a Web site on Windows can replicate the site or the packaged site directly through Remote Desktop, but in fact SSH can not only support the command line, but also support file transfer, I use free open source FileZilla (https:// filezilla-project.org/), FileZilla supports FTP and SSH two protocols, select the SFTP protocol in the site manager, then set the login type to normal, enter the user name and password to log in.
The default path after login is/home/username/, which is the same as the default directory under the command line. The default path for Apache is/var/www/, where you can find index.html, which is the "it Works" page. However, it is not possible to deploy the site directly to this directory because the user's permissions are not writable. Of course, you can change the permissions of this directory under Putty and then upload, but in fact there can be more simple way, is to upload the package files to the user directory and then unzip to this directory.
First install the ZIP decompression program, package details: http://packages.ubuntu.com/quantal/zip
sudo apt-get install zip
Then package the site you want to upload as a zip file, then upload it to the user directory (/home/username/), and then enter it on the command line.
sudo unzip compressed file name. zip-d/var/www
Of course, now using your browser to access your server address is still "It works", we also want to delete index.html on it.
sudo rm/var/www/index.html
"Iv. operation under openSUSE"
Different systems use different package management programs, and SuSE provides a package manager called Zypper, which is also very handy (the openSUSE used here is openSUSE 12.3 available on azure).
The first is to install Apache.
sudo zypper install apache2
Unlike the Ubuntu installation process, the Apache prompts are not started after the installation is complete. So you also need to manually configure the service self-boot.
sudo systemctl enable Apache2.service
Then immediately launch Apache.
Now you can access the server with a browser.
You then use Zypper to install mono (where system.drawing will use Libgdiplus, and multi-lingual support will use Mono-locale-extras, but even then some components are not installed, which is explained later):
sudo zypper install Mod_mono libgdiplus Mono-locale-extras
The next step is to configure Mod_mono, which is recommended to use the officially provided http://go-mono.com/config-mod-mono/, as shown in the page open:
You can choose virtual Host or Application two modes, the first can set the root path of the ASP. NET Web site based on the requested server address, and the second can set the root path of the ASP. In addition to the page below there are several settings can be customized, after the selection page download download. conf file, after uploading the file to the openSUSE server, use the following command to copy to the Apache Configuration folder:
sudo cp configuration file name. conf/etc/apache2/conf.d/
After that, you can install the zip unzip tool (sudo zypper install zip) to opensuse like Ubuntu, and unzip the compressed file to the site root directory of your settings. Immediately after you restart the Apache server, you will be able to access the ASP Web site:
sudo systemctl restart Apache2.service
It is important to note that it is not possible to install many dependent libraries after this is done, and only the following parts are installed if you follow the above command:
So there may be a lot of components that need to be installed, such as when you need to connect to an Oracle database, you may be prompted not to find the System.Data.OracleClient assembly, you need to install "mono-data-oracle", and then you can install it based on the error that occurred. In fact, you can also install "mono*" according to the wildcard character, the installation of mono-related, but this will also install a lot of unnecessary components.
"V. Operation under CentOS"
The Software management program for CentOS is Yum (the CentOS used here is the CentOS 6.3 available on azure).
The first is to install Apache.
sudo yum install httpd
Similar to openSUSE, it is necessary to manually configure the service self-boot itself after installation.
sudo chkconfig--levels 235 httpd on
Then immediately launch the Apache service.
SUDO/ETC/INIT.D/HTTPD start
The HTTP server can now be accessed with the browser's access to the server address.
But CentOS does not have a packaged mono RPM package, so the better way is to build it yourself.
The compiled environment is configured first.
sudo yum install gcc gcc-c++ bison pkgconfig glib2-devel gettext make freetype-devel fontconfig-devel libx11-devel libpng- Devel libjpeg-devel libtiff-devel giflib-devel libexif-devel cairo-devel httpd-devel
You may be prompted to upgrade kernel-headers, but the system may disable the core package by default, so if the above command fails to perform the installation, you will need to append "--disableexcludes=main" to the previous command, which is the form below.
sudo yum install gcc gcc-c++ bison pkgconfig glib2-devel gettext make freetype-devel fontconfig-devel libx11-devel libpng- Devel libjpeg-devel libtiff-devel giflib-devel libexif-devel cairo-devel httpd-devel--disableexcludes=main
If all is successfully installed, you can execute the following statement to download and decompress the source package that requires the component to be installed.
Cd/usr/src/sudo wget http://download.mono-project.com/sources/libgdiplus/libgdiplus-2.10.tar.bz2sudo wget/http Download.mono-project.com/sources/mono/mono-2.10.8.tar.bz2sudo wget HTTP://DOWNLOAD.MONO-PROJECT.COM/SOURCES/XSP /xsp-2.10.tar.bz2sudo wget Http://download.mono-project.com/sources/mod_mono/mod_mono-2.10.tar.bz2sudo Tar jxf Libgdiplus-2.10.tar.bz2sudo tar jxf mono-2.10.8.tar.bz2sudo tar jxf xsp-2.10.tar.bz2sudo tar jxf mod_mono-2.10.tar.bz2
Compile and install Libgdiplus.
Cd/usr/src/libgdiplus-2.10sudo./configure--prefix=/usrsudo make; sudo make install
Then edit the/etc/ld.so.conf file, add a line "/usr/lib/", as shown, save and then execute the following command, so that the system can automatically map Libgdiplus.dll to the corresponding so file. (See in the original: http://www.mono-project.com/DllNotFoundException)
sudo ldconfig
Then, Mono.
Cd/usr/src/mono-2.10.8sudo./configure--prefix=/usrsudo make; sudo make install
Next, install XSP.
Export Pkg_config_path=/usr/lib/pkgconfigcd/usr/src/xsp-2.10sudo./configure--prefix=/usrsudo make; sudo make install
Then install Mod_mono.
Cd/usr/src/mod_mono-2.10sudo./configure--prefix=/usrsudo make; sudo make install
And then modify the "/etc/httpd/conf/mod_mono.conf" this file, with the same name on Ubuntu configuration file configuration. However, because there is no ready-made configuration file like Ubuntu, so you need to add the following two lines in the file, since the installation of the automatic installation of 2.0 and 4.0 support, so you can change the following 2 for 4 to enable ASP:
Monoserverpath "/usr/bin/mod-mono-server2" Monoautoapplication enabled
Then copy the configuration file to the Apache configuration file directory:
sudo cp/etc/httpd/conf/mod_mono.conf/etc/httpd/conf.d/
Due to the reason that CentOS comes with SELinux, Apache cannot connect to Mod-mono-server, so we now need to configure SELinux. Of course, in order to simply disable SELinux here, it is interesting to create your own security policy so that mod-mono-server can take effect. This modifies the/etc/sysconfig/selinux file. Modify "selinux=enforcing" to "selinux=permissive" or "selinux=disabled", for example, to save the reboot system.
After that, you can upload the Web site by SSH and you can access it directly. However, it is important to note that the Apache default root path on CentOS is under "/var/www/html", and of course the path to the root directory of the Web site can be modified in the "/etc/httpd/conf/httpd.conf" file.
"Vi. RELATED LINKS"
1. Configure Linux (Apache) + Mono to run asp.net:http://www.cnblogs.com/hcl0208/archive/2010/10/25/1860173.html
2. Install mono on openSUSE and publish the asp: http://www.linuxidc.com/Linux/2011-04/34872.htm
3. CentOS 6.0 installation MONO 2.10.8:http://www.cnblogs.com/aquilahkj/archive/2011/11/03/2234380.html
4, the mono environment does not support the Chinese solution: http://www.cnblogs.com/shanyou/archive/2010/10/08/1846198.html
Configuring ASP (Apache + Mono) reprint + supplement under Linux (Ubuntu/opensuse/centos)