Build a HUSTOJ record on the Campus Network

Source: Internet
Author: User
Tags ssh server

Last semester, I told the network management center that I had to build an OJ on the campus network many times. At that time, the teacher said that I had to wait until the virtualization was completed ". Until last week, I finally applied for a virtual host, 4 cores, 10 Gb memory, GB hard disk on the campus network. It should be okay to run an OJ.

At the beginning, I plan to assign a public IP address and finally assign an intranet IP address, T ^ T

As soon as the ssh server is installed, it is ready to change soures. list. After the source of 163 is changed, apt-get update always fails. It is very depressing. If it is changed back, the result will still not work.

Only ping knows, all the Internet cannot be pinged. No, I thought of downloading all the software packages to my machine and copying them to the server with scp one by one. As a result, an apache was not installed in the afternoon, and dependencies were layer by layer, A headache. Go back and find a method-lan software source. After a try, the local apt-get install a git, which can be installed on the server. At that time, I was very happy ~

The result is that when you install apache2, the dependent database is gone, and I have been cleaned up before.

At the end of the first day, I went back and reinstalled my computer on ubuntu.

Intranet software source configuration

Host

First, upgrade the host.

# Apt-getupdate)

# Apt-getupgrade

After completion

These update files are retained in/var/cache/apt/archives.

Install dpkg-dev

# Apt-getinstall dpkg-dev

Install apache2

# Apt-getinstall apache2

Create four Directories

# Mkdir/var/www/soft (store the Installation File)

# Mkdir/var/www/dists

# Mkdir/var/www/dists/lucid

# Mkdir/var/www/dists/lucid/main

# Mkdir/var/www/dists/lucid/main/binary-i386

Copy the files in the/var/cache/apt/archives/directory to the/var/www/soft/directory.

# Cp/var/cache/apt/archives/*/var/www/soft

Go to the/var/www/directory and start packaging.

# Cd/var/www/

# Dpkg-scanpackagessoft/dev/null | gzip>/var/www/dists/lucid/main/binary-i386/Packages.gz

Client

Modify/etc/apt/source. list

Delete original content

Add debhttp: // 192.168.6.16 lucid mian

6.16 is the IP address of my host

Start update

# Apt-getupdate

# Apt-getupgrade

The next day. The previously installed software for ubuntu is gone ....

Svn is installed first. check Code:

Svn checkout http://hustoj.googlecode.com/svn/tags/1.2rc/ hustoj1.2

Check Code, compress, and prepare scp to the server:

Tar-czvf hustoj1.2.tar.gz hustoj1.2

Scp hustoj1.2.tar.gz xxx @ xxx

Server Terminal:

Tar-xzvf hustoj1.2.tar.gz

Install the software that HUSTOJ depends on the local machine:

Sudo apt-get install flex g ++ libmysql ++-dev php5 apache2 mysql-server php5-mysql php5-gd php5-cli mono-gmcs subversion

In fact, you can do it without installing. apt-get download is fine. To download the software and the software they depend on to/var/cache/apt/archives

Next we will use the above method, and the result will not work on the server. apt-get install will always fail and will be depressed.

A-f option can be added suddenly. Apt-get install-f xxx

To change the code:

Install/judge. conf database account & password, find the database account & password on the php page:

Cd web

Grep-n-R "\" root \ "* find the file and the number of lines, modify it on the server, and then cp to/var/www.

With excitement, open my browser and enter the server IP address, "It works"

There is nothing added to the OJ directory! Open it again, or there is no god code!

Baidu and google search for "php code debugging" (java web still understands a little bit, php does not know it at all). The server should look at error. log, Crazy Search:

Tree-I-f/| grep error. after finding the log, open it and see "Call to undefined function mysql_pconnect () in/var/www/OJ/includ e/db_info.inc.php on line 36". The database driver is not added

Change php. ini:

Tree-I-f/| grep php. ini uncomment row extension = mysql. so

Restart apache:

Apache2ctl restart: browsing again. Successful!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.